Thu, 30 Aug 2012 11:20:01 -0400
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: Bill Pittore <bill.pittore@oracle.com>
1.1 --- a/agent/make/saenv.sh Fri Aug 17 16:47:04 2012 -0700 1.2 +++ b/agent/make/saenv.sh Thu Aug 30 11:20:01 2012 -0400 1.3 @@ -26,7 +26,7 @@ 1.4 # This file sets common environment variables for all SA scripts 1.5 1.6 OS=`uname` 1.7 -STARTDIR=`dirname $0` 1.8 +STARTDIR=`(cd \`dirname $0 \`; pwd)` 1.9 ARCH=`uname -m` 1.10 1.11 if [ "x$SA_JAVA" = "x" ]; then
2.1 --- a/agent/make/start-debug-server-proc.sh Fri Aug 17 16:47:04 2012 -0700 2.2 +++ b/agent/make/start-debug-server-proc.sh Thu Aug 30 11:20:01 2012 -0400 2.3 @@ -25,10 +25,11 @@ 2.4 2.5 . `dirname $0`/saenv.sh 2.6 2.7 -if [ -f $STARTDIR/sa.jar ] ; then 2.8 - CP=$STARTDIR/sa.jar 2.9 +if [ -f $STARTDIR/../lib/sa-jdi.jar ] ; then 2.10 + CP=$STARTDIR/../lib/sa-jdi.jar 2.11 else 2.12 CP=$STARTDIR/../build/classes 2.13 fi 2.14 2.15 -$SA_JAVA -classpath $CP ${OPTIONS} -Djava.rmi.server.codebase=file:/$CP -Djava.security.policy=$STARTDIR\/grantAll.policy sun.jvm.hotspot.DebugServer $* 2.16 +$STARTDIR/java -classpath $CP ${OPTIONS} -Djava.rmi.server.codebase=file://$CP -Djava.security.policy=${STARTDIR}/grantAll.policy sun.jvm.hotspot.DebugServer $* 2.17 +
3.1 --- a/agent/src/os/linux/LinuxDebuggerLocal.c Fri Aug 17 16:47:04 2012 -0700 3.2 +++ b/agent/src/os/linux/LinuxDebuggerLocal.c Thu Aug 30 11:20:01 2012 -0400 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -55,11 +55,11 @@ 3.11 #define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throw_new_debugger_exception(env, str); return value; } 3.12 #define THROW_NEW_DEBUGGER_EXCEPTION(str) { throw_new_debugger_exception(env, str); return;} 3.13 3.14 -static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) { 3.15 +void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) { 3.16 (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg); 3.17 } 3.18 3.19 -static struct ps_prochandle* get_proc_handle(JNIEnv* env, jobject this_obj) { 3.20 +struct ps_prochandle* get_proc_handle(JNIEnv* env, jobject this_obj) { 3.21 jlong ptr = (*env)->GetLongField(env, this_obj, p_ps_prochandle_ID); 3.22 return (struct ps_prochandle*)(intptr_t)ptr; 3.23 } 3.24 @@ -280,6 +280,7 @@ 3.25 return (err == PS_OK)? array : 0; 3.26 } 3.27 3.28 +#if defined(i386) || defined(ia64) || defined(amd64) || defined(sparc) || defined(sparcv9) 3.29 JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_getThreadIntegerRegisterSet0 3.30 (JNIEnv *env, jobject this_obj, jint lwp_id) { 3.31 3.32 @@ -410,3 +411,4 @@ 3.33 (*env)->ReleaseLongArrayElements(env, array, regs, JNI_COMMIT); 3.34 return array; 3.35 } 3.36 +#endif
4.1 --- a/agent/src/os/linux/libproc.h Fri Aug 17 16:47:04 2012 -0700 4.2 +++ b/agent/src/os/linux/libproc.h Thu Aug 30 11:20:01 2012 -0400 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -25,10 +25,15 @@ 4.11 #ifndef _LIBPROC_H_ 4.12 #define _LIBPROC_H_ 4.13 4.14 +#include <jni.h> 4.15 #include <unistd.h> 4.16 #include <stdint.h> 4.17 #include "proc_service.h" 4.18 4.19 +#if defined(arm) || defined(ppc) 4.20 +#include "libproc_md.h" 4.21 +#endif 4.22 + 4.23 #if defined(sparc) || defined(sparcv9) 4.24 /* 4.25 If _LP64 is defined ptrace.h should be taken from /usr/include/asm-sparc64 4.26 @@ -139,4 +144,8 @@ 4.27 // address->nearest symbol lookup. return NULL for no symbol 4.28 const char* symbol_for_pc(struct ps_prochandle* ph, uintptr_t addr, uintptr_t* poffset); 4.29 4.30 +struct ps_prochandle* get_proc_handle(JNIEnv* env, jobject this_obj); 4.31 + 4.32 +void throw_new_debugger_exception(JNIEnv* env, const char* errMsg); 4.33 + 4.34 #endif //__LIBPROC_H_
5.1 --- a/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Fri Aug 17 16:47:04 2012 -0700 5.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Thu Aug 30 11:20:01 2012 -0400 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -549,7 +549,13 @@ 5.11 machDesc = new MachineDescriptionSPARC32Bit(); 5.12 } 5.13 } else { 5.14 - throw new DebuggerException("Linux only supported on x86/ia64/amd64/sparc/sparc64"); 5.15 + try { 5.16 + machDesc = (MachineDescription) 5.17 + Class.forName("sun.jvm.hotspot.debugger.MachineDescription" + 5.18 + cpu.toUpperCase()).newInstance(); 5.19 + } catch (Exception e) { 5.20 + throw new DebuggerException("Linux not supported on machine type " + cpu); 5.21 + } 5.22 } 5.23 5.24 LinuxDebuggerLocal dbg =
6.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java Fri Aug 17 16:47:04 2012 -0700 6.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java Thu Aug 30 11:20:01 2012 -0400 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -737,9 +737,16 @@ 6.11 machDesc = new MachineDescriptionSPARC32Bit(); 6.12 } 6.13 } else { 6.14 - throw new DebuggerException("Linux only supported on x86/ia64/amd64/sparc/sparc64"); 6.15 + try { 6.16 + machDesc = (MachineDescription) 6.17 + Class.forName("sun.jvm.hotspot.debugger.MachineDescription" + 6.18 + cpu.toUpperCase()).newInstance(); 6.19 + } catch (Exception e) { 6.20 + throw new DebuggerException("unsupported machine type"); 6.21 + } 6.22 } 6.23 6.24 + 6.25 // Note we do not use a cache for the local debugger in server 6.26 // mode; it will be taken care of on the client side (once remote 6.27 // debugging is implemented).
7.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/ThreadContext.java Fri Aug 17 16:47:04 2012 -0700 7.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/ThreadContext.java Thu Aug 30 11:20:01 2012 -0400 7.3 @@ -24,6 +24,8 @@ 7.4 7.5 package sun.jvm.hotspot.debugger; 7.6 7.7 +import sun.jvm.hotspot.debugger.cdbg.*; 7.8 + 7.9 /** This is a placeholder interface for a thread's context, containing 7.10 only integer registers (no floating-point ones). What it contains 7.11 is platform-dependent. Not all registers are guaranteed to be 7.12 @@ -54,4 +56,6 @@ 7.13 /** Set the value of the specified register (0..getNumRegisters() - 7.14 1) as an Address */ 7.15 public void setRegisterAsAddress(int index, Address value); 7.16 + 7.17 + public CFrame getTopFrame(Debugger dbg); 7.18 }
8.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/amd64/AMD64ThreadContext.java Fri Aug 17 16:47:04 2012 -0700 8.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/amd64/AMD64ThreadContext.java Thu Aug 30 11:20:01 2012 -0400 8.3 @@ -25,6 +25,7 @@ 8.4 package sun.jvm.hotspot.debugger.amd64; 8.5 8.6 import sun.jvm.hotspot.debugger.*; 8.7 +import sun.jvm.hotspot.debugger.cdbg.*; 8.8 8.9 /** Specifies the thread context on amd64 platforms; only a sub-portion 8.10 * of the context is guaranteed to be present on all operating 8.11 @@ -98,6 +99,10 @@ 8.12 return data[index]; 8.13 } 8.14 8.15 + public CFrame getTopFrame(Debugger dbg) { 8.16 + return null; 8.17 + } 8.18 + 8.19 /** This can't be implemented in this class since we would have to 8.20 * tie the implementation to, for example, the debugging system */ 8.21 public abstract void setRegisterAsAddress(int index, Address value);
9.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/ia64/IA64ThreadContext.java Fri Aug 17 16:47:04 2012 -0700 9.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/ia64/IA64ThreadContext.java Thu Aug 30 11:20:01 2012 -0400 9.3 @@ -25,6 +25,7 @@ 9.4 package sun.jvm.hotspot.debugger.ia64; 9.5 9.6 import sun.jvm.hotspot.debugger.*; 9.7 +import sun.jvm.hotspot.debugger.cdbg.*; 9.8 9.9 /** Specifies the thread context on ia64 platform; only a sub-portion 9.10 of the context is guaranteed to be present on all operating 9.11 @@ -172,6 +173,10 @@ 9.12 return data[index]; 9.13 } 9.14 9.15 + public CFrame getTopFrame(Debugger dbg) { 9.16 + return null; 9.17 + } 9.18 + 9.19 /** This can't be implemented in this class since we would have to 9.20 tie the implementation to, for example, the debugging system */ 9.21 public abstract void setRegisterAsAddress(int index, Address value);
10.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java Fri Aug 17 16:47:04 2012 -0700 10.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java Thu Aug 30 11:20:01 2012 -0400 10.3 @@ -1,5 +1,5 @@ 10.4 /* 10.5 - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. 10.6 + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 10.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.8 * 10.9 * This code is free software; you can redistribute it and/or modify it 10.10 @@ -107,7 +107,9 @@ 10.11 if (pc == null) return null; 10.12 return new LinuxSPARCCFrame(dbg, sp, pc, LinuxDebuggerLocal.getAddressSize()); 10.13 } else { 10.14 - throw new DebuggerException(cpu + " is not yet supported"); 10.15 + // Runtime exception thrown by LinuxThreadContextFactory if unknown cpu 10.16 + ThreadContext context = (ThreadContext) thread.getContext(); 10.17 + return context.getTopFrame(dbg); 10.18 } 10.19 } 10.20
11.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java Fri Aug 17 16:47:04 2012 -0700 11.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java Thu Aug 30 11:20:01 2012 -0400 11.3 @@ -1,5 +1,5 @@ 11.4 /* 11.5 - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. 11.6 + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 11.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.8 * 11.9 * This code is free software; you can redistribute it and/or modify it 11.10 @@ -24,6 +24,7 @@ 11.11 11.12 package sun.jvm.hotspot.debugger.linux; 11.13 11.14 +import java.lang.reflect.*; 11.15 import sun.jvm.hotspot.debugger.*; 11.16 import sun.jvm.hotspot.debugger.linux.amd64.*; 11.17 import sun.jvm.hotspot.debugger.linux.ia64.*; 11.18 @@ -41,8 +42,16 @@ 11.19 return new LinuxIA64ThreadContext(dbg); 11.20 } else if (cpu.equals("sparc")) { 11.21 return new LinuxSPARCThreadContext(dbg); 11.22 - } else { 11.23 - throw new RuntimeException("cpu " + cpu + " is not yet supported"); 11.24 + } else { 11.25 + try { 11.26 + Class tcc = Class.forName("sun.jvm.hotspot.debugger.linux." + 11.27 + cpu.toLowerCase() + ".Linux" + cpu.toUpperCase() + 11.28 + "ThreadContext"); 11.29 + Constructor[] ctcc = tcc.getConstructors(); 11.30 + return (ThreadContext)ctcc[0].newInstance(dbg); 11.31 + } catch (Exception e) { 11.32 + throw new RuntimeException("cpu " + cpu + " is not yet supported"); 11.33 + } 11.34 } 11.35 } 11.36 }
12.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java Fri Aug 17 16:47:04 2012 -0700 12.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java Thu Aug 30 11:20:01 2012 -0400 12.3 @@ -1,5 +1,5 @@ 12.4 /* 12.5 - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. 12.6 + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 12.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.8 * 12.9 * This code is free software; you can redistribute it and/or modify it 12.10 @@ -27,6 +27,7 @@ 12.11 import java.io.*; 12.12 import java.net.*; 12.13 import java.util.*; 12.14 +import java.lang.reflect.*; 12.15 import sun.jvm.hotspot.debugger.*; 12.16 import sun.jvm.hotspot.debugger.cdbg.*; 12.17 import sun.jvm.hotspot.debugger.proc.amd64.*; 12.18 @@ -86,7 +87,16 @@ 12.19 pcRegIndex = AMD64ThreadContext.RIP; 12.20 fpRegIndex = AMD64ThreadContext.RBP; 12.21 } else { 12.22 + try { 12.23 + Class tfc = Class.forName("sun.jvm.hotspot.debugger.proc." + 12.24 + cpu.toLowerCase() + ".Proc" + cpu.toUpperCase() + 12.25 + "ThreadFactory"); 12.26 + Constructor[] ctfc = tfc.getConstructors(); 12.27 + threadFactory = (ProcThreadFactory)ctfc[0].newInstance(this); 12.28 + } catch (Exception e) { 12.29 throw new RuntimeException("Thread access for CPU architecture " + PlatformInfo.getCPU() + " not yet supported"); 12.30 + // Note: pcRegIndex and fpRegIndex do not appear to be referenced 12.31 + } 12.32 } 12.33 if (useCache) { 12.34 // Cache portion of the remote process's address space. 12.35 @@ -375,7 +385,11 @@ 12.36 int pagesize = getPageSize0(); 12.37 if (pagesize == -1) { 12.38 // return the hard coded default value. 12.39 - pagesize = (PlatformInfo.getCPU().equals("x86"))? 4096 : 8192; 12.40 + if (PlatformInfo.getCPU().equals("sparc") || 12.41 + PlatformInfo.getCPU().equals("amd64") ) 12.42 + pagesize = 8196; 12.43 + else 12.44 + pagesize = 4096; 12.45 } 12.46 return pagesize; 12.47 }
13.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java Fri Aug 17 16:47:04 2012 -0700 13.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java Thu Aug 30 11:20:01 2012 -0400 13.3 @@ -1,5 +1,5 @@ 13.4 /* 13.5 - * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved. 13.6 + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 13.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.8 * 13.9 * This code is free software; you can redistribute it and/or modify it 13.10 @@ -26,6 +26,7 @@ 13.11 13.12 import java.rmi.*; 13.13 import java.util.*; 13.14 +import java.lang.reflect.*; 13.15 13.16 import sun.jvm.hotspot.debugger.*; 13.17 import sun.jvm.hotspot.debugger.cdbg.*; 13.18 @@ -70,7 +71,18 @@ 13.19 cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); 13.20 unalignedAccessesOkay = true; 13.21 } else { 13.22 - throw new DebuggerException("Thread access for CPU architecture " + cpu + " not yet supported"); 13.23 + try { 13.24 + Class tf = Class.forName("sun.jvm.hotspot.debugger.remote." + 13.25 + cpu.toLowerCase() + ".Remote" + cpu.toUpperCase() + 13.26 + "ThreadFactory"); 13.27 + Constructor[] ctf = tf.getConstructors(); 13.28 + threadFactory = (RemoteThreadFactory)ctf[0].newInstance(this); 13.29 + } catch (Exception e) { 13.30 + throw new DebuggerException("Thread access for CPU architecture " + cpu + " not yet supported"); 13.31 + } 13.32 + cachePageSize = 4096; 13.33 + cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); 13.34 + unalignedAccessesOkay = false; 13.35 } 13.36 13.37 // Cache portion of the remote process's address space.
14.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/sparc/SPARCThreadContext.java Fri Aug 17 16:47:04 2012 -0700 14.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/sparc/SPARCThreadContext.java Thu Aug 30 11:20:01 2012 -0400 14.3 @@ -25,6 +25,7 @@ 14.4 package sun.jvm.hotspot.debugger.sparc; 14.5 14.6 import sun.jvm.hotspot.debugger.*; 14.7 +import sun.jvm.hotspot.debugger.cdbg.*; 14.8 14.9 /** Currently provides just the minimal information necessary to get 14.10 stack traces working. FIXME: currently hardwired for v9 -- will 14.11 @@ -124,6 +125,10 @@ 14.12 return data[index]; 14.13 } 14.14 14.15 + public CFrame getTopFrame(Debugger dbg) { 14.16 + return null; 14.17 + } 14.18 + 14.19 /** This can't be implemented in this class since we would have to 14.20 tie the implementation to, for example, the debugging system */ 14.21 public abstract void setRegisterAsAddress(int index, Address value);
15.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/x86/X86ThreadContext.java Fri Aug 17 16:47:04 2012 -0700 15.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/x86/X86ThreadContext.java Thu Aug 30 11:20:01 2012 -0400 15.3 @@ -25,6 +25,7 @@ 15.4 package sun.jvm.hotspot.debugger.x86; 15.5 15.6 import sun.jvm.hotspot.debugger.*; 15.7 +import sun.jvm.hotspot.debugger.cdbg.*; 15.8 15.9 /** Specifies the thread context on x86 platforms; only a sub-portion 15.10 of the context is guaranteed to be present on all operating 15.11 @@ -109,6 +110,10 @@ 15.12 return data[index]; 15.13 } 15.14 15.15 + public CFrame getTopFrame(Debugger dbg) { 15.16 + return null; 15.17 + } 15.18 + 15.19 /** This can't be implemented in this class since we would have to 15.20 tie the implementation to, for example, the debugging system */ 15.21 public abstract void setRegisterAsAddress(int index, Address value);
16.1 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Fri Aug 17 16:47:04 2012 -0700 16.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Thu Aug 30 11:20:01 2012 -0400 16.3 @@ -1,5 +1,5 @@ 16.4 /* 16.5 - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 16.6 + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 16.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.8 * 16.9 * This code is free software; you can redistribute it and/or modify it 16.10 @@ -91,6 +91,16 @@ 16.11 access = new LinuxAMD64JavaThreadPDAccess(); 16.12 } else if (cpu.equals("sparc")) { 16.13 access = new LinuxSPARCJavaThreadPDAccess(); 16.14 + } else { 16.15 + try { 16.16 + access = (JavaThreadPDAccess) 16.17 + Class.forName("sun.jvm.hotspot.runtime.linux_" + 16.18 + cpu.toLowerCase() + ".Linux" + cpu.toUpperCase() + 16.19 + "JavaThreadPDAccess").newInstance(); 16.20 + } catch (Exception e) { 16.21 + throw new RuntimeException("OS/CPU combination " + os + "/" + cpu + 16.22 + " not yet supported"); 16.23 + } 16.24 } 16.25 } else if (os.equals("bsd")) { 16.26 if (cpu.equals("x86")) {
17.1 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Fri Aug 17 16:47:04 2012 -0700 17.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Thu Aug 30 11:20:01 2012 -0400 17.3 @@ -92,6 +92,8 @@ 17.4 private boolean usingServerCompiler; 17.5 /** Flag indicating whether UseTLAB is turned on */ 17.6 private boolean useTLAB; 17.7 + /** Flag indicating whether invokedynamic support is on */ 17.8 + private boolean enableInvokeDynamic; 17.9 /** alignment constants */ 17.10 private boolean isLP64; 17.11 private int bytesPerLong; 17.12 @@ -317,6 +319,7 @@ 17.13 } 17.14 17.15 useTLAB = (db.lookupIntConstant("UseTLAB").intValue() != 0); 17.16 + enableInvokeDynamic = (db.lookupIntConstant("EnableInvokeDynamic").intValue() != 0); 17.17 17.18 if (debugger != null) { 17.19 isLP64 = debugger.getMachineDescription().isLP64(); 17.20 @@ -552,6 +555,10 @@ 17.21 return useTLAB; 17.22 } 17.23 17.24 + public boolean getEnableInvokeDynamic() { 17.25 + return enableInvokeDynamic; 17.26 + } 17.27 + 17.28 public TypeDataBase getTypeDataBase() { 17.29 return db; 17.30 }
18.1 --- a/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java Fri Aug 17 16:47:04 2012 -0700 18.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java Thu Aug 30 11:20:01 2012 -0400 18.3 @@ -204,7 +204,13 @@ 18.4 } else if (cpu.equals("ia64")) { 18.5 cpuHelper = new IA64Helper(); 18.6 } else { 18.7 + try { 18.8 + cpuHelper = (CPUHelper)Class.forName("sun.jvm.hotspot.asm." + 18.9 + cpu.toLowerCase() + "." + cpu.toUpperCase() + 18.10 + "Helper").newInstance(); 18.11 + } catch (Exception e) { 18.12 throw new RuntimeException("cpu '" + cpu + "' is not yet supported!"); 18.13 + } 18.14 } 18.15 } 18.16
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/AltPlatformInfo.java Thu Aug 30 11:20:01 2012 -0400 19.3 @@ -0,0 +1,31 @@ 19.4 +/* 19.5 + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.7 + * 19.8 + * This code is free software; you can redistribute it and/or modify it 19.9 + * under the terms of the GNU General Public License version 2 only, as 19.10 + * published by the Free Software Foundation. 19.11 + * 19.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 19.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19.15 + * version 2 for more details (a copy is included in the LICENSE file that 19.16 + * accompanied this code). 19.17 + * 19.18 + * You should have received a copy of the GNU General Public License version 19.19 + * 2 along with this work; if not, write to the Free Software Foundation, 19.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19.21 + * 19.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19.23 + * or visit www.oracle.com if you need additional information or have any 19.24 + * questions. 19.25 + * 19.26 + */ 19.27 + 19.28 +package sun.jvm.hotspot.utilities; 19.29 + 19.30 +public interface AltPlatformInfo { 19.31 + // Additional cpu types can be tested via this interface 19.32 + 19.33 + public boolean knownCPU(String cpu); 19.34 +} 19.35 \ No newline at end of file
20.1 --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java Fri Aug 17 16:47:04 2012 -0700 20.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java Thu Aug 30 11:20:01 2012 -0400 20.3 @@ -64,6 +64,13 @@ 20.4 } else if (cpu.equals("ia64") || cpu.equals("amd64") || cpu.equals("x86_64")) { 20.5 return cpu; 20.6 } else { 20.7 + try { 20.8 + Class pic = Class.forName("sun.jvm.hotspot.utilities.PlatformInfoClosed"); 20.9 + AltPlatformInfo api = (AltPlatformInfo)pic.newInstance(); 20.10 + if (api.knownCPU(cpu)) { 20.11 + return cpu; 20.12 + } 20.13 + } catch (Exception e) {} 20.14 throw new UnsupportedPlatformException("CPU type " + cpu + " not yet supported"); 20.15 } 20.16 }
21.1 --- a/make/defs.make Fri Aug 17 16:47:04 2012 -0700 21.2 +++ b/make/defs.make Thu Aug 30 11:20:01 2012 -0400 21.3 @@ -22,6 +22,14 @@ 21.4 # 21.5 # 21.6 21.7 +ifeq ($(HS_ALT_MAKE),) 21.8 + ifneq ($(OPENJDK),true) 21.9 + HS_ALT_MAKE=$(GAMMADIR)/make/closed 21.10 + else 21.11 + HS_ALT_MAKE=NO_SUCH_PATH 21.12 + endif 21.13 +endif 21.14 + 21.15 # The common definitions for hotspot builds. 21.16 21.17 # Optionally include SPEC file generated by configure. 21.18 @@ -327,3 +335,4 @@ 21.19 ifndef JAVASE_EMBEDDED 21.20 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jfr.h 21.21 endif 21.22 +
22.1 --- a/make/linux/makefiles/defs.make Fri Aug 17 16:47:04 2012 -0700 22.2 +++ b/make/linux/makefiles/defs.make Thu Aug 30 11:20:01 2012 -0400 22.3 @@ -295,6 +295,8 @@ 22.4 ADD_SA_BINARIES/arm = 22.5 ADD_SA_BINARIES/zero = 22.6 22.7 +-include $(HS_ALT_MAKE)/linux/makefiles/defs.make 22.8 + 22.9 EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH)) 22.10 22.11
23.1 --- a/make/linux/makefiles/sa.make Fri Aug 17 16:47:04 2012 -0700 23.2 +++ b/make/linux/makefiles/sa.make Thu Aug 30 11:20:01 2012 -0400 23.3 @@ -30,10 +30,16 @@ 23.4 23.5 include $(GAMMADIR)/make/linux/makefiles/rules.make 23.6 23.7 +include $(GAMMADIR)/make/defs.make 23.8 +include $(GAMMADIR)/make/altsrc.make 23.9 + 23.10 AGENT_DIR = $(GAMMADIR)/agent 23.11 23.12 include $(GAMMADIR)/make/sa.files 23.13 23.14 +-include $(HS_ALT_MAKE)/linux/makefiles/sa.make 23.15 + 23.16 + 23.17 TOPDIR = $(shell echo `pwd`) 23.18 GENERATED = $(TOPDIR)/../generated 23.19 23.20 @@ -52,17 +58,15 @@ 23.21 SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties 23.22 23.23 # if $(AGENT_DIR) does not exist, we don't build SA 23.24 -# also, we don't build SA on Itanium, PowerPC, ARM or zero. 23.25 +# also, we don't build SA on Itanium or zero. 23.26 23.27 all: 23.28 if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \ 23.29 - -a "$(SRCARCH)" != "arm" \ 23.30 - -a "$(SRCARCH)" != "ppc" \ 23.31 -a "$(SRCARCH)" != "zero" ] ; then \ 23.32 $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \ 23.33 fi 23.34 23.35 -$(GENERATED)/sa-jdi.jar: $(AGENT_FILES) 23.36 +$(GENERATED)/sa-jdi.jar:: $(AGENT_FILES) 23.37 $(QUIETLY) echo "Making $@" 23.38 $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ 23.39 echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ 23.40 @@ -111,3 +115,5 @@ 23.41 rm -rf $(SA_CLASSDIR) 23.42 rm -rf $(GENERATED)/sa-jdi.jar 23.43 rm -rf $(AGENT_FILES_LIST) 23.44 + 23.45 +-include $(HS_ALT_MAKE)/linux/makefiles/sa-rules.make
24.1 --- a/make/linux/makefiles/saproc.make Fri Aug 17 16:47:04 2012 -0700 24.2 +++ b/make/linux/makefiles/saproc.make Thu Aug 30 11:20:01 2012 -0400 24.3 @@ -21,6 +21,8 @@ 24.4 # questions. 24.5 # 24.6 # 24.7 +include $(GAMMADIR)/make/defs.make 24.8 +include $(GAMMADIR)/make/altsrc.make 24.9 24.10 # Rules to build serviceability agent library, used by vm.make 24.11 24.12 @@ -48,6 +50,8 @@ 24.13 $(SASRCDIR)/ps_core.c \ 24.14 $(SASRCDIR)/LinuxDebuggerLocal.c 24.15 24.16 +-include $(HS_ALT_MAKE)/linux/makefiles/saproc.make 24.17 + 24.18 SAMAPFILE = $(SASRCDIR)/mapfile 24.19 24.20 DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC) 24.21 @@ -60,15 +64,19 @@ 24.22 endif 24.23 24.24 # if $(AGENT_DIR) does not exist, we don't build SA 24.25 -# also, we don't build SA on Itanium, PPC, ARM or zero. 24.26 +# also, we don't build SA on Itanium or zero. 24.27 24.28 ifneq ($(wildcard $(AGENT_DIR)),) 24.29 -ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),) 24.30 +ifneq ($(filter-out ia64 zero,$(SRCARCH)),) 24.31 BUILDLIBSAPROC = $(LIBSAPROC) 24.32 endif 24.33 endif 24.34 24.35 - 24.36 +ifneq ($(ALT_SASRCDIR),) 24.37 +ALT_SAINCDIR=-I$(ALT_SASRCDIR) 24.38 +else 24.39 +ALT_SAINCDIR= 24.40 +endif 24.41 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE) 24.42 24.43 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) 24.44 @@ -84,6 +92,7 @@ 24.45 -I$(GENERATED) \ 24.46 -I$(BOOT_JAVA_HOME)/include \ 24.47 -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \ 24.48 + $(ALT_SAINCDIR) \ 24.49 $(SASRCFILES) \ 24.50 $(SA_LFLAGS) \ 24.51 $(SA_DEBUG_CFLAGS) \
25.1 --- a/src/share/vm/runtime/vmStructs.cpp Fri Aug 17 16:47:04 2012 -0700 25.2 +++ b/src/share/vm/runtime/vmStructs.cpp Thu Aug 30 11:20:01 2012 -0400 25.3 @@ -2135,6 +2135,7 @@ 25.4 /******************/ \ 25.5 \ 25.6 declare_constant(UseTLAB) \ 25.7 + declare_constant(EnableInvokeDynamic) \ 25.8 \ 25.9 /**************/ \ 25.10 /* Stack bias */ \