提交 9998e626 编写于 作者: B bpittore

7154641: Servicability agent should work on platforms other than x86, sparc

Summary: Added capability to load support classes for other cpus
Reviewed-by: coleenp, bobv, sla
Contributed-by: NBill Pittore <bill.pittore@oracle.com>
上级 c07bfc60
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# This file sets common environment variables for all SA scripts # This file sets common environment variables for all SA scripts
OS=`uname` OS=`uname`
STARTDIR=`dirname $0` STARTDIR=`(cd \`dirname $0 \`; pwd)`
ARCH=`uname -m` ARCH=`uname -m`
if [ "x$SA_JAVA" = "x" ]; then if [ "x$SA_JAVA" = "x" ]; then
......
...@@ -25,10 +25,11 @@ ...@@ -25,10 +25,11 @@
. `dirname $0`/saenv.sh . `dirname $0`/saenv.sh
if [ -f $STARTDIR/sa.jar ] ; then if [ -f $STARTDIR/../lib/sa-jdi.jar ] ; then
CP=$STARTDIR/sa.jar CP=$STARTDIR/../lib/sa-jdi.jar
else else
CP=$STARTDIR/../build/classes CP=$STARTDIR/../build/classes
fi fi
$SA_JAVA -classpath $CP ${OPTIONS} -Djava.rmi.server.codebase=file:/$CP -Djava.security.policy=$STARTDIR\/grantAll.policy sun.jvm.hotspot.DebugServer $* $STARTDIR/java -classpath $CP ${OPTIONS} -Djava.rmi.server.codebase=file://$CP -Djava.security.policy=${STARTDIR}/grantAll.policy sun.jvm.hotspot.DebugServer $*
/* /*
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -55,11 +55,11 @@ static jmethodID listAdd_ID = 0; ...@@ -55,11 +55,11 @@ static jmethodID listAdd_ID = 0;
#define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throw_new_debugger_exception(env, str); return value; } #define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throw_new_debugger_exception(env, str); return value; }
#define THROW_NEW_DEBUGGER_EXCEPTION(str) { throw_new_debugger_exception(env, str); return;} #define THROW_NEW_DEBUGGER_EXCEPTION(str) { throw_new_debugger_exception(env, str); return;}
static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) { void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) {
(*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg); (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg);
} }
static struct ps_prochandle* get_proc_handle(JNIEnv* env, jobject this_obj) { struct ps_prochandle* get_proc_handle(JNIEnv* env, jobject this_obj) {
jlong ptr = (*env)->GetLongField(env, this_obj, p_ps_prochandle_ID); jlong ptr = (*env)->GetLongField(env, this_obj, p_ps_prochandle_ID);
return (struct ps_prochandle*)(intptr_t)ptr; return (struct ps_prochandle*)(intptr_t)ptr;
} }
...@@ -280,6 +280,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo ...@@ -280,6 +280,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo
return (err == PS_OK)? array : 0; return (err == PS_OK)? array : 0;
} }
#if defined(i386) || defined(ia64) || defined(amd64) || defined(sparc) || defined(sparcv9)
JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_getThreadIntegerRegisterSet0 JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_getThreadIntegerRegisterSet0
(JNIEnv *env, jobject this_obj, jint lwp_id) { (JNIEnv *env, jobject this_obj, jint lwp_id) {
...@@ -410,3 +411,4 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo ...@@ -410,3 +411,4 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo
(*env)->ReleaseLongArrayElements(env, array, regs, JNI_COMMIT); (*env)->ReleaseLongArrayElements(env, array, regs, JNI_COMMIT);
return array; return array;
} }
#endif
/* /*
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,10 +25,15 @@ ...@@ -25,10 +25,15 @@
#ifndef _LIBPROC_H_ #ifndef _LIBPROC_H_
#define _LIBPROC_H_ #define _LIBPROC_H_
#include <jni.h>
#include <unistd.h> #include <unistd.h>
#include <stdint.h> #include <stdint.h>
#include "proc_service.h" #include "proc_service.h"
#if defined(arm) || defined(ppc)
#include "libproc_md.h"
#endif
#if defined(sparc) || defined(sparcv9) #if defined(sparc) || defined(sparcv9)
/* /*
If _LP64 is defined ptrace.h should be taken from /usr/include/asm-sparc64 If _LP64 is defined ptrace.h should be taken from /usr/include/asm-sparc64
...@@ -139,4 +144,8 @@ uintptr_t lookup_symbol(struct ps_prochandle* ph, const char* object_name, ...@@ -139,4 +144,8 @@ uintptr_t lookup_symbol(struct ps_prochandle* ph, const char* object_name,
// address->nearest symbol lookup. return NULL for no symbol // address->nearest symbol lookup. return NULL for no symbol
const char* symbol_for_pc(struct ps_prochandle* ph, uintptr_t addr, uintptr_t* poffset); const char* symbol_for_pc(struct ps_prochandle* ph, uintptr_t addr, uintptr_t* poffset);
struct ps_prochandle* get_proc_handle(JNIEnv* env, jobject this_obj);
void throw_new_debugger_exception(JNIEnv* env, const char* errMsg);
#endif //__LIBPROC_H_ #endif //__LIBPROC_H_
/* /*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -549,7 +549,13 @@ public class HotSpotAgent { ...@@ -549,7 +549,13 @@ public class HotSpotAgent {
machDesc = new MachineDescriptionSPARC32Bit(); machDesc = new MachineDescriptionSPARC32Bit();
} }
} else { } else {
throw new DebuggerException("Linux only supported on x86/ia64/amd64/sparc/sparc64"); try {
machDesc = (MachineDescription)
Class.forName("sun.jvm.hotspot.debugger.MachineDescription" +
cpu.toUpperCase()).newInstance();
} catch (Exception e) {
throw new DebuggerException("Linux not supported on machine type " + cpu);
}
} }
LinuxDebuggerLocal dbg = LinuxDebuggerLocal dbg =
......
/* /*
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -737,8 +737,15 @@ public class BugSpotAgent { ...@@ -737,8 +737,15 @@ public class BugSpotAgent {
machDesc = new MachineDescriptionSPARC32Bit(); machDesc = new MachineDescriptionSPARC32Bit();
} }
} else { } else {
throw new DebuggerException("Linux only supported on x86/ia64/amd64/sparc/sparc64"); try {
machDesc = (MachineDescription)
Class.forName("sun.jvm.hotspot.debugger.MachineDescription" +
cpu.toUpperCase()).newInstance();
} catch (Exception e) {
throw new DebuggerException("unsupported machine type");
} }
}
// Note we do not use a cache for the local debugger in server // Note we do not use a cache for the local debugger in server
// mode; it will be taken care of on the client side (once remote // mode; it will be taken care of on the client side (once remote
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
package sun.jvm.hotspot.debugger; package sun.jvm.hotspot.debugger;
import sun.jvm.hotspot.debugger.cdbg.*;
/** This is a placeholder interface for a thread's context, containing /** This is a placeholder interface for a thread's context, containing
only integer registers (no floating-point ones). What it contains only integer registers (no floating-point ones). What it contains
is platform-dependent. Not all registers are guaranteed to be is platform-dependent. Not all registers are guaranteed to be
...@@ -54,4 +56,6 @@ public interface ThreadContext { ...@@ -54,4 +56,6 @@ public interface ThreadContext {
/** Set the value of the specified register (0..getNumRegisters() - /** Set the value of the specified register (0..getNumRegisters() -
1) as an Address */ 1) as an Address */
public void setRegisterAsAddress(int index, Address value); public void setRegisterAsAddress(int index, Address value);
public CFrame getTopFrame(Debugger dbg);
} }
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
package sun.jvm.hotspot.debugger.amd64; package sun.jvm.hotspot.debugger.amd64;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
/** Specifies the thread context on amd64 platforms; only a sub-portion /** Specifies the thread context on amd64 platforms; only a sub-portion
* of the context is guaranteed to be present on all operating * of the context is guaranteed to be present on all operating
...@@ -98,6 +99,10 @@ public abstract class AMD64ThreadContext implements ThreadContext { ...@@ -98,6 +99,10 @@ public abstract class AMD64ThreadContext implements ThreadContext {
return data[index]; return data[index];
} }
public CFrame getTopFrame(Debugger dbg) {
return null;
}
/** This can't be implemented in this class since we would have to /** This can't be implemented in this class since we would have to
* tie the implementation to, for example, the debugging system */ * tie the implementation to, for example, the debugging system */
public abstract void setRegisterAsAddress(int index, Address value); public abstract void setRegisterAsAddress(int index, Address value);
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
package sun.jvm.hotspot.debugger.ia64; package sun.jvm.hotspot.debugger.ia64;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
/** Specifies the thread context on ia64 platform; only a sub-portion /** Specifies the thread context on ia64 platform; only a sub-portion
of the context is guaranteed to be present on all operating of the context is guaranteed to be present on all operating
...@@ -172,6 +173,10 @@ public abstract class IA64ThreadContext implements ThreadContext { ...@@ -172,6 +173,10 @@ public abstract class IA64ThreadContext implements ThreadContext {
return data[index]; return data[index];
} }
public CFrame getTopFrame(Debugger dbg) {
return null;
}
/** This can't be implemented in this class since we would have to /** This can't be implemented in this class since we would have to
tie the implementation to, for example, the debugging system */ tie the implementation to, for example, the debugging system */
public abstract void setRegisterAsAddress(int index, Address value); public abstract void setRegisterAsAddress(int index, Address value);
......
/* /*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -107,7 +107,9 @@ class LinuxCDebugger implements CDebugger { ...@@ -107,7 +107,9 @@ class LinuxCDebugger implements CDebugger {
if (pc == null) return null; if (pc == null) return null;
return new LinuxSPARCCFrame(dbg, sp, pc, LinuxDebuggerLocal.getAddressSize()); return new LinuxSPARCCFrame(dbg, sp, pc, LinuxDebuggerLocal.getAddressSize());
} else { } else {
throw new DebuggerException(cpu + " is not yet supported"); // Runtime exception thrown by LinuxThreadContextFactory if unknown cpu
ThreadContext context = (ThreadContext) thread.getContext();
return context.getTopFrame(dbg);
} }
} }
......
/* /*
* Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
package sun.jvm.hotspot.debugger.linux; package sun.jvm.hotspot.debugger.linux;
import java.lang.reflect.*;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.linux.amd64.*; import sun.jvm.hotspot.debugger.linux.amd64.*;
import sun.jvm.hotspot.debugger.linux.ia64.*; import sun.jvm.hotspot.debugger.linux.ia64.*;
...@@ -42,7 +43,15 @@ class LinuxThreadContextFactory { ...@@ -42,7 +43,15 @@ class LinuxThreadContextFactory {
} else if (cpu.equals("sparc")) { } else if (cpu.equals("sparc")) {
return new LinuxSPARCThreadContext(dbg); return new LinuxSPARCThreadContext(dbg);
} else { } else {
try {
Class tcc = Class.forName("sun.jvm.hotspot.debugger.linux." +
cpu.toLowerCase() + ".Linux" + cpu.toUpperCase() +
"ThreadContext");
Constructor[] ctcc = tcc.getConstructors();
return (ThreadContext)ctcc[0].newInstance(dbg);
} catch (Exception e) {
throw new RuntimeException("cpu " + cpu + " is not yet supported"); throw new RuntimeException("cpu " + cpu + " is not yet supported");
} }
} }
}
} }
/* /*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -27,6 +27,7 @@ package sun.jvm.hotspot.debugger.proc; ...@@ -27,6 +27,7 @@ package sun.jvm.hotspot.debugger.proc;
import java.io.*; import java.io.*;
import java.net.*; import java.net.*;
import java.util.*; import java.util.*;
import java.lang.reflect.*;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.cdbg.*;
import sun.jvm.hotspot.debugger.proc.amd64.*; import sun.jvm.hotspot.debugger.proc.amd64.*;
...@@ -86,7 +87,16 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger { ...@@ -86,7 +87,16 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
pcRegIndex = AMD64ThreadContext.RIP; pcRegIndex = AMD64ThreadContext.RIP;
fpRegIndex = AMD64ThreadContext.RBP; fpRegIndex = AMD64ThreadContext.RBP;
} else { } else {
try {
Class tfc = Class.forName("sun.jvm.hotspot.debugger.proc." +
cpu.toLowerCase() + ".Proc" + cpu.toUpperCase() +
"ThreadFactory");
Constructor[] ctfc = tfc.getConstructors();
threadFactory = (ProcThreadFactory)ctfc[0].newInstance(this);
} catch (Exception e) {
throw new RuntimeException("Thread access for CPU architecture " + PlatformInfo.getCPU() + " not yet supported"); throw new RuntimeException("Thread access for CPU architecture " + PlatformInfo.getCPU() + " not yet supported");
// Note: pcRegIndex and fpRegIndex do not appear to be referenced
}
} }
if (useCache) { if (useCache) {
// Cache portion of the remote process's address space. // Cache portion of the remote process's address space.
...@@ -375,7 +385,11 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger { ...@@ -375,7 +385,11 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
int pagesize = getPageSize0(); int pagesize = getPageSize0();
if (pagesize == -1) { if (pagesize == -1) {
// return the hard coded default value. // return the hard coded default value.
pagesize = (PlatformInfo.getCPU().equals("x86"))? 4096 : 8192; if (PlatformInfo.getCPU().equals("sparc") ||
PlatformInfo.getCPU().equals("amd64") )
pagesize = 8196;
else
pagesize = 4096;
} }
return pagesize; return pagesize;
} }
......
/* /*
* Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,6 +26,7 @@ package sun.jvm.hotspot.debugger.remote; ...@@ -26,6 +26,7 @@ package sun.jvm.hotspot.debugger.remote;
import java.rmi.*; import java.rmi.*;
import java.util.*; import java.util.*;
import java.lang.reflect.*;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.cdbg.*;
...@@ -70,8 +71,19 @@ public class RemoteDebuggerClient extends DebuggerBase implements JVMDebugger { ...@@ -70,8 +71,19 @@ public class RemoteDebuggerClient extends DebuggerBase implements JVMDebugger {
cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
unalignedAccessesOkay = true; unalignedAccessesOkay = true;
} else { } else {
try {
Class tf = Class.forName("sun.jvm.hotspot.debugger.remote." +
cpu.toLowerCase() + ".Remote" + cpu.toUpperCase() +
"ThreadFactory");
Constructor[] ctf = tf.getConstructors();
threadFactory = (RemoteThreadFactory)ctf[0].newInstance(this);
} catch (Exception e) {
throw new DebuggerException("Thread access for CPU architecture " + cpu + " not yet supported"); throw new DebuggerException("Thread access for CPU architecture " + cpu + " not yet supported");
} }
cachePageSize = 4096;
cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
unalignedAccessesOkay = false;
}
// Cache portion of the remote process's address space. // Cache portion of the remote process's address space.
initCache(cachePageSize, cacheNumPages); initCache(cachePageSize, cacheNumPages);
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
package sun.jvm.hotspot.debugger.sparc; package sun.jvm.hotspot.debugger.sparc;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
/** Currently provides just the minimal information necessary to get /** Currently provides just the minimal information necessary to get
stack traces working. FIXME: currently hardwired for v9 -- will stack traces working. FIXME: currently hardwired for v9 -- will
...@@ -124,6 +125,10 @@ public abstract class SPARCThreadContext implements ThreadContext { ...@@ -124,6 +125,10 @@ public abstract class SPARCThreadContext implements ThreadContext {
return data[index]; return data[index];
} }
public CFrame getTopFrame(Debugger dbg) {
return null;
}
/** This can't be implemented in this class since we would have to /** This can't be implemented in this class since we would have to
tie the implementation to, for example, the debugging system */ tie the implementation to, for example, the debugging system */
public abstract void setRegisterAsAddress(int index, Address value); public abstract void setRegisterAsAddress(int index, Address value);
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
package sun.jvm.hotspot.debugger.x86; package sun.jvm.hotspot.debugger.x86;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
/** Specifies the thread context on x86 platforms; only a sub-portion /** Specifies the thread context on x86 platforms; only a sub-portion
of the context is guaranteed to be present on all operating of the context is guaranteed to be present on all operating
...@@ -109,6 +110,10 @@ public abstract class X86ThreadContext implements ThreadContext { ...@@ -109,6 +110,10 @@ public abstract class X86ThreadContext implements ThreadContext {
return data[index]; return data[index];
} }
public CFrame getTopFrame(Debugger dbg) {
return null;
}
/** This can't be implemented in this class since we would have to /** This can't be implemented in this class since we would have to
tie the implementation to, for example, the debugging system */ tie the implementation to, for example, the debugging system */
public abstract void setRegisterAsAddress(int index, Address value); public abstract void setRegisterAsAddress(int index, Address value);
......
/* /*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -91,6 +91,16 @@ public class Threads { ...@@ -91,6 +91,16 @@ public class Threads {
access = new LinuxAMD64JavaThreadPDAccess(); access = new LinuxAMD64JavaThreadPDAccess();
} else if (cpu.equals("sparc")) { } else if (cpu.equals("sparc")) {
access = new LinuxSPARCJavaThreadPDAccess(); access = new LinuxSPARCJavaThreadPDAccess();
} else {
try {
access = (JavaThreadPDAccess)
Class.forName("sun.jvm.hotspot.runtime.linux_" +
cpu.toLowerCase() + ".Linux" + cpu.toUpperCase() +
"JavaThreadPDAccess").newInstance();
} catch (Exception e) {
throw new RuntimeException("OS/CPU combination " + os + "/" + cpu +
" not yet supported");
}
} }
} else if (os.equals("bsd")) { } else if (os.equals("bsd")) {
if (cpu.equals("x86")) { if (cpu.equals("x86")) {
......
...@@ -92,6 +92,8 @@ public class VM { ...@@ -92,6 +92,8 @@ public class VM {
private boolean usingServerCompiler; private boolean usingServerCompiler;
/** Flag indicating whether UseTLAB is turned on */ /** Flag indicating whether UseTLAB is turned on */
private boolean useTLAB; private boolean useTLAB;
/** Flag indicating whether invokedynamic support is on */
private boolean enableInvokeDynamic;
/** alignment constants */ /** alignment constants */
private boolean isLP64; private boolean isLP64;
private int bytesPerLong; private int bytesPerLong;
...@@ -317,6 +319,7 @@ public class VM { ...@@ -317,6 +319,7 @@ public class VM {
} }
useTLAB = (db.lookupIntConstant("UseTLAB").intValue() != 0); useTLAB = (db.lookupIntConstant("UseTLAB").intValue() != 0);
enableInvokeDynamic = (db.lookupIntConstant("EnableInvokeDynamic").intValue() != 0);
if (debugger != null) { if (debugger != null) {
isLP64 = debugger.getMachineDescription().isLP64(); isLP64 = debugger.getMachineDescription().isLP64();
...@@ -552,6 +555,10 @@ public class VM { ...@@ -552,6 +555,10 @@ public class VM {
return useTLAB; return useTLAB;
} }
public boolean getEnableInvokeDynamic() {
return enableInvokeDynamic;
}
public TypeDataBase getTypeDataBase() { public TypeDataBase getTypeDataBase() {
return db; return db;
} }
......
...@@ -204,9 +204,15 @@ public class HTMLGenerator implements /* imports */ ClassConstants { ...@@ -204,9 +204,15 @@ public class HTMLGenerator implements /* imports */ ClassConstants {
} else if (cpu.equals("ia64")) { } else if (cpu.equals("ia64")) {
cpuHelper = new IA64Helper(); cpuHelper = new IA64Helper();
} else { } else {
try {
cpuHelper = (CPUHelper)Class.forName("sun.jvm.hotspot.asm." +
cpu.toLowerCase() + "." + cpu.toUpperCase() +
"Helper").newInstance();
} catch (Exception e) {
throw new RuntimeException("cpu '" + cpu + "' is not yet supported!"); throw new RuntimeException("cpu '" + cpu + "' is not yet supported!");
} }
} }
}
protected static synchronized CPUHelper getCPUHelper() { protected static synchronized CPUHelper getCPUHelper() {
return cpuHelper; return cpuHelper;
......
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.utilities;
public interface AltPlatformInfo {
// Additional cpu types can be tested via this interface
public boolean knownCPU(String cpu);
}
\ No newline at end of file
...@@ -64,6 +64,13 @@ public class PlatformInfo { ...@@ -64,6 +64,13 @@ public class PlatformInfo {
} else if (cpu.equals("ia64") || cpu.equals("amd64") || cpu.equals("x86_64")) { } else if (cpu.equals("ia64") || cpu.equals("amd64") || cpu.equals("x86_64")) {
return cpu; return cpu;
} else { } else {
try {
Class pic = Class.forName("sun.jvm.hotspot.utilities.PlatformInfoClosed");
AltPlatformInfo api = (AltPlatformInfo)pic.newInstance();
if (api.knownCPU(cpu)) {
return cpu;
}
} catch (Exception e) {}
throw new UnsupportedPlatformException("CPU type " + cpu + " not yet supported"); throw new UnsupportedPlatformException("CPU type " + cpu + " not yet supported");
} }
} }
......
...@@ -22,6 +22,14 @@ ...@@ -22,6 +22,14 @@
# #
# #
ifeq ($(HS_ALT_MAKE),)
ifneq ($(OPENJDK),true)
HS_ALT_MAKE=$(GAMMADIR)/make/closed
else
HS_ALT_MAKE=NO_SUCH_PATH
endif
endif
# The common definitions for hotspot builds. # The common definitions for hotspot builds.
# Optionally include SPEC file generated by configure. # Optionally include SPEC file generated by configure.
...@@ -327,3 +335,4 @@ EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h ...@@ -327,3 +335,4 @@ EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h
ifndef JAVASE_EMBEDDED ifndef JAVASE_EMBEDDED
EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jfr.h EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jfr.h
endif endif
...@@ -295,6 +295,8 @@ ADD_SA_BINARIES/ia64 = ...@@ -295,6 +295,8 @@ ADD_SA_BINARIES/ia64 =
ADD_SA_BINARIES/arm = ADD_SA_BINARIES/arm =
ADD_SA_BINARIES/zero = ADD_SA_BINARIES/zero =
-include $(HS_ALT_MAKE)/linux/makefiles/defs.make
EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH)) EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))
...@@ -30,10 +30,16 @@ ...@@ -30,10 +30,16 @@
include $(GAMMADIR)/make/linux/makefiles/rules.make include $(GAMMADIR)/make/linux/makefiles/rules.make
include $(GAMMADIR)/make/defs.make
include $(GAMMADIR)/make/altsrc.make
AGENT_DIR = $(GAMMADIR)/agent AGENT_DIR = $(GAMMADIR)/agent
include $(GAMMADIR)/make/sa.files include $(GAMMADIR)/make/sa.files
-include $(HS_ALT_MAKE)/linux/makefiles/sa.make
TOPDIR = $(shell echo `pwd`) TOPDIR = $(shell echo `pwd`)
GENERATED = $(TOPDIR)/../generated GENERATED = $(TOPDIR)/../generated
...@@ -52,17 +58,15 @@ SA_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VE ...@@ -52,17 +58,15 @@ SA_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VE
SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
# if $(AGENT_DIR) does not exist, we don't build SA # if $(AGENT_DIR) does not exist, we don't build SA
# also, we don't build SA on Itanium, PowerPC, ARM or zero. # also, we don't build SA on Itanium or zero.
all: all:
if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \ if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \
-a "$(SRCARCH)" != "arm" \
-a "$(SRCARCH)" != "ppc" \
-a "$(SRCARCH)" != "zero" ] ; then \ -a "$(SRCARCH)" != "zero" ] ; then \
$(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \ $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
fi fi
$(GENERATED)/sa-jdi.jar: $(AGENT_FILES) $(GENERATED)/sa-jdi.jar:: $(AGENT_FILES)
$(QUIETLY) echo "Making $@" $(QUIETLY) echo "Making $@"
$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
...@@ -111,3 +115,5 @@ clean: ...@@ -111,3 +115,5 @@ clean:
rm -rf $(SA_CLASSDIR) rm -rf $(SA_CLASSDIR)
rm -rf $(GENERATED)/sa-jdi.jar rm -rf $(GENERATED)/sa-jdi.jar
rm -rf $(AGENT_FILES_LIST) rm -rf $(AGENT_FILES_LIST)
-include $(HS_ALT_MAKE)/linux/makefiles/sa-rules.make
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
# questions. # questions.
# #
# #
include $(GAMMADIR)/make/defs.make
include $(GAMMADIR)/make/altsrc.make
# Rules to build serviceability agent library, used by vm.make # Rules to build serviceability agent library, used by vm.make
...@@ -48,6 +50,8 @@ SASRCFILES = $(SASRCDIR)/salibelf.c \ ...@@ -48,6 +50,8 @@ SASRCFILES = $(SASRCDIR)/salibelf.c \
$(SASRCDIR)/ps_core.c \ $(SASRCDIR)/ps_core.c \
$(SASRCDIR)/LinuxDebuggerLocal.c $(SASRCDIR)/LinuxDebuggerLocal.c
-include $(HS_ALT_MAKE)/linux/makefiles/saproc.make
SAMAPFILE = $(SASRCDIR)/mapfile SAMAPFILE = $(SASRCDIR)/mapfile
DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC) DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
...@@ -60,15 +64,19 @@ ifeq ($(DEBUG_BINARIES), true) ...@@ -60,15 +64,19 @@ ifeq ($(DEBUG_BINARIES), true)
endif endif
# if $(AGENT_DIR) does not exist, we don't build SA # if $(AGENT_DIR) does not exist, we don't build SA
# also, we don't build SA on Itanium, PPC, ARM or zero. # also, we don't build SA on Itanium or zero.
ifneq ($(wildcard $(AGENT_DIR)),) ifneq ($(wildcard $(AGENT_DIR)),)
ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),) ifneq ($(filter-out ia64 zero,$(SRCARCH)),)
BUILDLIBSAPROC = $(LIBSAPROC) BUILDLIBSAPROC = $(LIBSAPROC)
endif endif
endif endif
ifneq ($(ALT_SASRCDIR),)
ALT_SAINCDIR=-I$(ALT_SASRCDIR)
else
ALT_SAINCDIR=
endif
SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE) SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE)
$(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
...@@ -84,6 +92,7 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) ...@@ -84,6 +92,7 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
-I$(GENERATED) \ -I$(GENERATED) \
-I$(BOOT_JAVA_HOME)/include \ -I$(BOOT_JAVA_HOME)/include \
-I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \ -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \
$(ALT_SAINCDIR) \
$(SASRCFILES) \ $(SASRCFILES) \
$(SA_LFLAGS) \ $(SA_LFLAGS) \
$(SA_DEBUG_CFLAGS) \ $(SA_DEBUG_CFLAGS) \
......
...@@ -2135,6 +2135,7 @@ typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable; ...@@ -2135,6 +2135,7 @@ typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable;
/******************/ \ /******************/ \
\ \
declare_constant(UseTLAB) \ declare_constant(UseTLAB) \
declare_constant(EnableInvokeDynamic) \
\ \
/**************/ \ /**************/ \
/* Stack bias */ \ /* Stack bias */ \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册