# HG changeset patch # User anoll # Date 1390806117 28800 # Node ID 303f79ab8e3dfc9158d54fef665ea0d784d4cd49 # Parent 11985e4d42554d27fa2d5171ea3919805ed9a071# Parent 0a66ed4b0b27fccc32e77ee9b328d6c9a50cf9cb Merge diff -r 11985e4d4255 -r 303f79ab8e3d agent/src/os/linux/symtab.c --- a/agent/src/os/linux/symtab.c Mon Jan 27 07:54:25 2014 +0100 +++ b/agent/src/os/linux/symtab.c Sun Jan 26 23:01:57 2014 -0800 @@ -214,8 +214,10 @@ + 2); strcpy(debug_pathname, name); char *last_slash = strrchr(debug_pathname, '/'); - if (last_slash == NULL) + if (last_slash == NULL) { + free(debug_pathname); return -1; + } /* Look in the same directory as the object. */ strcpy(last_slash+1, debug_filename); diff -r 11985e4d4255 -r 303f79ab8e3d agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java Mon Jan 27 07:54:25 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java Sun Jan 26 23:01:57 2014 -0800 @@ -24,19 +24,29 @@ package sun.jvm.hotspot.jdi; -import com.sun.jdi.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; import sun.jvm.hotspot.oops.ArrayKlass; +import sun.jvm.hotspot.oops.Instance; import sun.jvm.hotspot.oops.InstanceKlass; -import sun.jvm.hotspot.oops.ObjArrayKlass; -import sun.jvm.hotspot.oops.TypeArrayKlass; import sun.jvm.hotspot.oops.Klass; -import sun.jvm.hotspot.oops.Instance; +import sun.jvm.hotspot.oops.ObjArrayKlass; import sun.jvm.hotspot.oops.Symbol; -import java.util.List; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Map; +import sun.jvm.hotspot.oops.TypeArrayKlass; + +import com.sun.jdi.ArrayReference; +import com.sun.jdi.ArrayType; +import com.sun.jdi.ClassLoaderReference; +import com.sun.jdi.ClassNotLoadedException; +import com.sun.jdi.InterfaceType; +import com.sun.jdi.Method; +import com.sun.jdi.PrimitiveType; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.Type; +import com.sun.jdi.VirtualMachine; public class ArrayTypeImpl extends ReferenceTypeImpl implements ArrayType { protected ArrayTypeImpl(VirtualMachine aVm, ArrayKlass aRef) { @@ -75,7 +85,8 @@ } } - void addVisibleMethods(Map methodMap) { + @Override + void addVisibleMethods(Map methodMap, Set handledInterfaces) { // arrays don't have methods } diff -r 11985e4d4255 -r 303f79ab8e3d agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java Mon Jan 27 07:54:25 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java Sun Jan 26 23:01:57 2014 -0800 @@ -24,12 +24,30 @@ package sun.jvm.hotspot.jdi; -import com.sun.jdi.*; -import sun.jvm.hotspot.oops.Klass; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + import sun.jvm.hotspot.oops.InstanceKlass; -import java.util.*; -import java.lang.ref.SoftReference; +import com.sun.jdi.ClassNotLoadedException; +import com.sun.jdi.ClassType; +import com.sun.jdi.Field; +import com.sun.jdi.IncompatibleThreadStateException; +import com.sun.jdi.InterfaceType; +import com.sun.jdi.InvalidTypeException; +import com.sun.jdi.InvocationException; +import com.sun.jdi.Method; +import com.sun.jdi.ObjectReference; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.ThreadReference; +import com.sun.jdi.Value; +import com.sun.jdi.VirtualMachine; public class ClassTypeImpl extends ReferenceTypeImpl implements ClassType @@ -195,22 +213,26 @@ return null; } - void addVisibleMethods(Map methodMap) { + @Override + void addVisibleMethods(Map methodMap, Set seenInterfaces) { /* * Add methods from * parent types first, so that the methods in this class will * overwrite them in the hash table */ - Iterator iter = interfaces().iterator(); + Iterator iter = interfaces().iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); - interfaze.addVisibleMethods(methodMap); + if (!seenInterfaces.contains(interfaze)) { + interfaze.addVisibleMethods(methodMap, seenInterfaces); + seenInterfaces.add(interfaze); + } } ClassTypeImpl clazz = (ClassTypeImpl)superclass(); if (clazz != null) { - clazz.addVisibleMethods(methodMap); + clazz.addVisibleMethods(methodMap, seenInterfaces); } addToMethodMap(methodMap, methods()); diff -r 11985e4d4255 -r 303f79ab8e3d agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java Mon Jan 27 07:54:25 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java Sun Jan 26 23:01:57 2014 -0800 @@ -24,15 +24,22 @@ package sun.jvm.hotspot.jdi; -import com.sun.jdi.*; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + import sun.jvm.hotspot.oops.InstanceKlass; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.Iterator; -import java.util.Collections; -import java.lang.ref.SoftReference; +import com.sun.jdi.ClassNotPreparedException; +import com.sun.jdi.ClassType; +import com.sun.jdi.InterfaceType; +import com.sun.jdi.Method; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.VirtualMachine; public class InterfaceTypeImpl extends ReferenceTypeImpl implements InterfaceType { @@ -96,16 +103,20 @@ return implementors; } - void addVisibleMethods(Map methodMap) { + @Override + void addVisibleMethods(Map methodMap, Set seenInterfaces) { /* * Add methods from * parent types first, so that the methods in this class will * overwrite them in the hash table */ - Iterator iter = superinterfaces().iterator(); + Iterator iter = superinterfaces().iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); - interfaze.addVisibleMethods(methodMap); + if (!seenInterfaces.contains(interfaze)) { + interfaze.addVisibleMethods(methodMap, seenInterfaces); + seenInterfaces.add(interfaze); + } } addToMethodMap(methodMap, methods()); diff -r 11985e4d4255 -r 303f79ab8e3d agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java Mon Jan 27 07:54:25 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java Sun Jan 26 23:01:57 2014 -0800 @@ -24,24 +24,45 @@ package sun.jvm.hotspot.jdi; -import java.io.*; - -import com.sun.jdi.*; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; import sun.jvm.hotspot.memory.SystemDictionary; +import sun.jvm.hotspot.oops.ArrayKlass; +import sun.jvm.hotspot.oops.DefaultHeapVisitor; import sun.jvm.hotspot.oops.Instance; import sun.jvm.hotspot.oops.InstanceKlass; -import sun.jvm.hotspot.oops.ArrayKlass; import sun.jvm.hotspot.oops.JVMDIClassStatus; import sun.jvm.hotspot.oops.Klass; -import sun.jvm.hotspot.oops.ObjArray; import sun.jvm.hotspot.oops.Oop; import sun.jvm.hotspot.oops.Symbol; -import sun.jvm.hotspot.oops.DefaultHeapVisitor; import sun.jvm.hotspot.utilities.Assert; -import java.util.*; -import java.lang.ref.SoftReference; +import com.sun.jdi.AbsentInformationException; +import com.sun.jdi.ArrayType; +import com.sun.jdi.ClassLoaderReference; +import com.sun.jdi.ClassNotLoadedException; +import com.sun.jdi.ClassNotPreparedException; +import com.sun.jdi.ClassObjectReference; +import com.sun.jdi.Field; +import com.sun.jdi.InterfaceType; +import com.sun.jdi.Method; +import com.sun.jdi.ObjectReference; +import com.sun.jdi.PrimitiveType; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.Type; +import com.sun.jdi.Value; +import com.sun.jdi.VirtualMachine; public abstract class ReferenceTypeImpl extends TypeImpl implements ReferenceType { @@ -421,7 +442,8 @@ } } - abstract void addVisibleMethods(Map methodMap); + abstract void addVisibleMethods(Map methodMap, Set seenInterfaces); + public final List visibleMethods() throws ClassNotPreparedException { checkPrepared(); /* @@ -430,8 +452,8 @@ * concatenation of name and signature. */ //System.out.println("jj: RTI: Calling addVisibleMethods for:" + this); - Map map = new HashMap(); - addVisibleMethods(map); + Map map = new HashMap(); + addVisibleMethods(map, new HashSet()); /* * ... but the hash map destroys order. Methods should be @@ -441,7 +463,7 @@ */ //System.out.println("jj: RTI: Calling allMethods for:" + this); - List list = new ArrayList(allMethods()); + List list = new ArrayList(allMethods()); //System.out.println("jj: allMethods = " + jjstr(list)); //System.out.println("jj: map = " + map.toString()); //System.out.println("jj: map = " + jjstr(map.values())); diff -r 11985e4d4255 -r 303f79ab8e3d make/bsd/makefiles/adjust-mflags.sh --- a/make/bsd/makefiles/adjust-mflags.sh Mon Jan 27 07:54:25 2014 +0100 +++ b/make/bsd/makefiles/adjust-mflags.sh Sun Jan 26 23:01:57 2014 -0800 @@ -64,7 +64,7 @@ echo "$MFLAGS" \ | sed ' s/^-/ -/ - s/ -\([^ ][^ ]*\)j/ -\1 -j/ + s/ -\([^ I][^ I]*\)j/ -\1 -j/ s/ -j[0-9][0-9]*/ -j/ s/ -j\([^ ]\)/ -j -\1/ s/ -j/ -j'${HOTSPOT_BUILD_JOBS:-${default_build_jobs}}'/ diff -r 11985e4d4255 -r 303f79ab8e3d make/bsd/makefiles/debug.make --- a/make/bsd/makefiles/debug.make Mon Jan 27 07:54:25 2014 +0100 +++ b/make/bsd/makefiles/debug.make Sun Jan 26 23:01:57 2014 -0800 @@ -36,6 +36,9 @@ # Linker mapfile MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug +ifeq ($(OS_VENDOR), Darwin) +MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-darwin-debug +endif VERSION = debug SYSDEFS += -DASSERT diff -r 11985e4d4255 -r 303f79ab8e3d make/bsd/makefiles/fastdebug.make --- a/make/bsd/makefiles/fastdebug.make Mon Jan 27 07:54:25 2014 +0100 +++ b/make/bsd/makefiles/fastdebug.make Sun Jan 26 23:01:57 2014 -0800 @@ -57,6 +57,9 @@ # Linker mapfile MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug +ifeq ($(OS_VENDOR), Darwin) +MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-darwin-debug +endif VERSION = fastdebug SYSDEFS += -DASSERT -DCHECK_UNHANDLED_OOPS diff -r 11985e4d4255 -r 303f79ab8e3d make/bsd/makefiles/mapfile-vers-darwin-debug --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/bsd/makefiles/mapfile-vers-darwin-debug Sun Jan 26 23:01:57 2014 -0800 @@ -0,0 +1,256 @@ +# +# Copyright (c) 2002, 2013, 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. +# +# +# Only used for OSX/Darwin builds + +# Define public interface. + # _JNI + _JNI_CreateJavaVM + _JNI_GetCreatedJavaVMs + _JNI_GetDefaultJavaVMInitArgs + + # _JVM + _JVM_Accept + _JVM_ActiveProcessorCount + _JVM_AllocateNewArray + _JVM_AllocateNewObject + _JVM_ArrayCopy + _JVM_AssertionStatusDirectives + _JVM_Available + _JVM_Bind + _JVM_ClassDepth + _JVM_ClassLoaderDepth + _JVM_Clone + _JVM_Close + _JVM_CX8Field + _JVM_CompileClass + _JVM_CompileClasses + _JVM_CompilerCommand + _JVM_Connect + _JVM_ConstantPoolGetClassAt + _JVM_ConstantPoolGetClassAtIfLoaded + _JVM_ConstantPoolGetDoubleAt + _JVM_ConstantPoolGetFieldAt + _JVM_ConstantPoolGetFieldAtIfLoaded + _JVM_ConstantPoolGetFloatAt + _JVM_ConstantPoolGetIntAt + _JVM_ConstantPoolGetLongAt + _JVM_ConstantPoolGetMethodAt + _JVM_ConstantPoolGetMethodAtIfLoaded + _JVM_ConstantPoolGetMemberRefInfoAt + _JVM_ConstantPoolGetSize + _JVM_ConstantPoolGetStringAt + _JVM_ConstantPoolGetUTF8At + _JVM_CountStackFrames + _JVM_CurrentClassLoader + _JVM_CurrentLoadedClass + _JVM_CurrentThread + _JVM_CurrentTimeMillis + _JVM_DefineClass + _JVM_DefineClassWithSource + _JVM_DefineClassWithSourceCond + _JVM_DesiredAssertionStatus + _JVM_DisableCompiler + _JVM_DoPrivileged + _JVM_DTraceGetVersion + _JVM_DTraceActivate + _JVM_DTraceIsProbeEnabled + _JVM_DTraceIsSupported + _JVM_DTraceDispose + _JVM_DumpAllStacks + _JVM_DumpThreads + _JVM_EnableCompiler + _JVM_Exit + _JVM_FillInStackTrace + _JVM_FindClassFromClass + _JVM_FindClassFromClassLoader + _JVM_FindClassFromBootLoader + _JVM_FindLibraryEntry + _JVM_FindLoadedClass + _JVM_FindPrimitiveClass + _JVM_FindSignal + _JVM_FreeMemory + _JVM_GC + _JVM_GetAllThreads + _JVM_GetArrayElement + _JVM_GetArrayLength + _JVM_GetCPClassNameUTF + _JVM_GetCPFieldClassNameUTF + _JVM_GetCPFieldModifiers + _JVM_GetCPFieldNameUTF + _JVM_GetCPFieldSignatureUTF + _JVM_GetCPMethodClassNameUTF + _JVM_GetCPMethodModifiers + _JVM_GetCPMethodNameUTF + _JVM_GetCPMethodSignatureUTF + _JVM_GetCallerClass + _JVM_GetClassAccessFlags + _JVM_GetClassAnnotations + _JVM_GetClassCPEntriesCount + _JVM_GetClassCPTypes + _JVM_GetClassConstantPool + _JVM_GetClassContext + _JVM_GetClassDeclaredConstructors + _JVM_GetClassDeclaredFields + _JVM_GetClassDeclaredMethods + _JVM_GetClassFieldsCount + _JVM_GetClassInterfaces + _JVM_GetClassLoader + _JVM_GetClassMethodsCount + _JVM_GetClassModifiers + _JVM_GetClassName + _JVM_GetClassNameUTF + _JVM_GetClassSignature + _JVM_GetClassSigners + _JVM_GetClassTypeAnnotations + _JVM_GetComponentType + _JVM_GetDeclaredClasses + _JVM_GetDeclaringClass + _JVM_GetEnclosingMethodInfo + _JVM_GetFieldAnnotations + _JVM_GetFieldIxModifiers + _JVM_GetFieldTypeAnnotations + _JVM_GetHostName + _JVM_GetInheritedAccessControlContext + _JVM_GetInterfaceVersion + _JVM_GetLastErrorString + _JVM_GetManagement + _JVM_GetMethodAnnotations + _JVM_GetMethodDefaultAnnotationValue + _JVM_GetMethodIxArgsSize + _JVM_GetMethodIxByteCode + _JVM_GetMethodIxByteCodeLength + _JVM_GetMethodIxExceptionIndexes + _JVM_GetMethodIxExceptionTableEntry + _JVM_GetMethodIxExceptionTableLength + _JVM_GetMethodIxExceptionsCount + _JVM_GetMethodIxLocalsCount + _JVM_GetMethodIxMaxStack + _JVM_GetMethodIxModifiers + _JVM_GetMethodIxNameUTF + _JVM_GetMethodIxSignatureUTF + _JVM_GetMethodParameterAnnotations + _JVM_GetMethodParameters + _JVM_GetMethodTypeAnnotations + _JVM_GetPrimitiveArrayElement + _JVM_GetProtectionDomain + _JVM_GetSockName + _JVM_GetSockOpt + _JVM_GetStackAccessControlContext + _JVM_GetStackTraceDepth + _JVM_GetStackTraceElement + _JVM_GetSystemPackage + _JVM_GetSystemPackages + _JVM_GetThreadStateNames + _JVM_GetThreadStateValues + _JVM_GetVersionInfo + _JVM_Halt + _JVM_HoldsLock + _JVM_IHashCode + _JVM_InitAgentProperties + _JVM_InitProperties + _JVM_InitializeCompiler + _JVM_InitializeSocketLibrary + _JVM_InternString + _JVM_Interrupt + _JVM_InvokeMethod + _JVM_IsArrayClass + _JVM_IsConstructorIx + _JVM_IsInterface + _JVM_IsInterrupted + _JVM_IsNaN + _JVM_IsPrimitiveClass + _JVM_IsSameClassPackage + _JVM_IsSilentCompiler + _JVM_IsSupportedJNIVersion + _JVM_IsThreadAlive + _JVM_IsVMGeneratedMethodIx + _JVM_LatestUserDefinedLoader + _JVM_Listen + _JVM_LoadClass0 + _JVM_LoadLibrary + _JVM_Lseek + _JVM_MaxObjectInspectionAge + _JVM_MaxMemory + _JVM_MonitorNotify + _JVM_MonitorNotifyAll + _JVM_MonitorWait + _JVM_NanoTime + _JVM_NativePath + _JVM_NewArray + _JVM_NewInstanceFromConstructor + _JVM_NewMultiArray + _JVM_OnExit + _JVM_Open + _JVM_RaiseSignal + _JVM_RawMonitorCreate + _JVM_RawMonitorDestroy + _JVM_RawMonitorEnter + _JVM_RawMonitorExit + _JVM_Read + _JVM_Recv + _JVM_RecvFrom + _JVM_RegisterSignal + _JVM_ReleaseUTF + _JVM_ResolveClass + _JVM_ResumeThread + _JVM_Send + _JVM_SendTo + _JVM_SetArrayElement + _JVM_SetClassSigners + _JVM_SetLength + _JVM_SetNativeThreadName + _JVM_SetPrimitiveArrayElement + _JVM_SetSockOpt + _JVM_SetThreadPriority + _JVM_Sleep + _JVM_Socket + _JVM_SocketAvailable + _JVM_SocketClose + _JVM_SocketShutdown + _JVM_StartThread + _JVM_StopThread + _JVM_SuspendThread + _JVM_SupportsCX8 + _JVM_Sync + _JVM_Timeout + _JVM_TotalMemory + _JVM_TraceInstructions + _JVM_TraceMethodCalls + _JVM_UnloadLibrary + _JVM_Write + _JVM_Yield + _JVM_handle_bsd_signal + + # miscellaneous functions + _jio_fprintf + _jio_printf + _jio_snprintf + _jio_vfprintf + _jio_vsnprintf + + # This is for Forte Analyzer profiling support. + _AsyncGetCallTrace + + # INSERT VTABLE SYMBOLS HERE + diff -r 11985e4d4255 -r 303f79ab8e3d make/bsd/makefiles/mapfile-vers-darwin-product --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/bsd/makefiles/mapfile-vers-darwin-product Sun Jan 26 23:01:57 2014 -0800 @@ -0,0 +1,256 @@ +# +# Copyright (c) 2002, 2013, 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. +# +# +# Only used for OSX/Darwin builds + +# Define public interface. + # _JNI + _JNI_CreateJavaVM + _JNI_GetCreatedJavaVMs + _JNI_GetDefaultJavaVMInitArgs + + # _JVM + _JVM_Accept + _JVM_ActiveProcessorCount + _JVM_AllocateNewArray + _JVM_AllocateNewObject + _JVM_ArrayCopy + _JVM_AssertionStatusDirectives + _JVM_Available + _JVM_Bind + _JVM_ClassDepth + _JVM_ClassLoaderDepth + _JVM_Clone + _JVM_Close + _JVM_CX8Field + _JVM_CompileClass + _JVM_CompileClasses + _JVM_CompilerCommand + _JVM_Connect + _JVM_ConstantPoolGetClassAt + _JVM_ConstantPoolGetClassAtIfLoaded + _JVM_ConstantPoolGetDoubleAt + _JVM_ConstantPoolGetFieldAt + _JVM_ConstantPoolGetFieldAtIfLoaded + _JVM_ConstantPoolGetFloatAt + _JVM_ConstantPoolGetIntAt + _JVM_ConstantPoolGetLongAt + _JVM_ConstantPoolGetMethodAt + _JVM_ConstantPoolGetMethodAtIfLoaded + _JVM_ConstantPoolGetMemberRefInfoAt + _JVM_ConstantPoolGetSize + _JVM_ConstantPoolGetStringAt + _JVM_ConstantPoolGetUTF8At + _JVM_CountStackFrames + _JVM_CurrentClassLoader + _JVM_CurrentLoadedClass + _JVM_CurrentThread + _JVM_CurrentTimeMillis + _JVM_DefineClass + _JVM_DefineClassWithSource + _JVM_DefineClassWithSourceCond + _JVM_DesiredAssertionStatus + _JVM_DisableCompiler + _JVM_DoPrivileged + _JVM_DTraceGetVersion + _JVM_DTraceActivate + _JVM_DTraceIsProbeEnabled + _JVM_DTraceIsSupported + _JVM_DTraceDispose + _JVM_DumpAllStacks + _JVM_DumpThreads + _JVM_EnableCompiler + _JVM_Exit + _JVM_FillInStackTrace + _JVM_FindClassFromClass + _JVM_FindClassFromClassLoader + _JVM_FindClassFromBootLoader + _JVM_FindLibraryEntry + _JVM_FindLoadedClass + _JVM_FindPrimitiveClass + _JVM_FindSignal + _JVM_FreeMemory + _JVM_GC + _JVM_GetAllThreads + _JVM_GetArrayElement + _JVM_GetArrayLength + _JVM_GetCPClassNameUTF + _JVM_GetCPFieldClassNameUTF + _JVM_GetCPFieldModifiers + _JVM_GetCPFieldNameUTF + _JVM_GetCPFieldSignatureUTF + _JVM_GetCPMethodClassNameUTF + _JVM_GetCPMethodModifiers + _JVM_GetCPMethodNameUTF + _JVM_GetCPMethodSignatureUTF + _JVM_GetCallerClass + _JVM_GetClassAccessFlags + _JVM_GetClassAnnotations + _JVM_GetClassCPEntriesCount + _JVM_GetClassCPTypes + _JVM_GetClassConstantPool + _JVM_GetClassContext + _JVM_GetClassDeclaredConstructors + _JVM_GetClassDeclaredFields + _JVM_GetClassDeclaredMethods + _JVM_GetClassFieldsCount + _JVM_GetClassInterfaces + _JVM_GetClassLoader + _JVM_GetClassMethodsCount + _JVM_GetClassModifiers + _JVM_GetClassName + _JVM_GetClassNameUTF + _JVM_GetClassSignature + _JVM_GetClassSigners + _JVM_GetClassTypeAnnotations + _JVM_GetComponentType + _JVM_GetDeclaredClasses + _JVM_GetDeclaringClass + _JVM_GetEnclosingMethodInfo + _JVM_GetFieldAnnotations + _JVM_GetFieldIxModifiers + _JVM_GetFieldTypeAnnotations + _JVM_GetHostName + _JVM_GetInheritedAccessControlContext + _JVM_GetInterfaceVersion + _JVM_GetLastErrorString + _JVM_GetManagement + _JVM_GetMethodAnnotations + _JVM_GetMethodDefaultAnnotationValue + _JVM_GetMethodIxArgsSize + _JVM_GetMethodIxByteCode + _JVM_GetMethodIxByteCodeLength + _JVM_GetMethodIxExceptionIndexes + _JVM_GetMethodIxExceptionTableEntry + _JVM_GetMethodIxExceptionTableLength + _JVM_GetMethodIxExceptionsCount + _JVM_GetMethodIxLocalsCount + _JVM_GetMethodIxMaxStack + _JVM_GetMethodIxModifiers + _JVM_GetMethodIxNameUTF + _JVM_GetMethodIxSignatureUTF + _JVM_GetMethodParameterAnnotations + _JVM_GetMethodParameters + _JVM_GetMethodTypeAnnotations + _JVM_GetPrimitiveArrayElement + _JVM_GetProtectionDomain + _JVM_GetSockName + _JVM_GetSockOpt + _JVM_GetStackAccessControlContext + _JVM_GetStackTraceDepth + _JVM_GetStackTraceElement + _JVM_GetSystemPackage + _JVM_GetSystemPackages + _JVM_GetThreadStateNames + _JVM_GetThreadStateValues + _JVM_GetVersionInfo + _JVM_Halt + _JVM_HoldsLock + _JVM_IHashCode + _JVM_InitAgentProperties + _JVM_InitProperties + _JVM_InitializeCompiler + _JVM_InitializeSocketLibrary + _JVM_InternString + _JVM_Interrupt + _JVM_InvokeMethod + _JVM_IsArrayClass + _JVM_IsConstructorIx + _JVM_IsInterface + _JVM_IsInterrupted + _JVM_IsNaN + _JVM_IsPrimitiveClass + _JVM_IsSameClassPackage + _JVM_IsSilentCompiler + _JVM_IsSupportedJNIVersion + _JVM_IsThreadAlive + _JVM_IsVMGeneratedMethodIx + _JVM_LatestUserDefinedLoader + _JVM_Listen + _JVM_LoadClass0 + _JVM_LoadLibrary + _JVM_Lseek + _JVM_MaxObjectInspectionAge + _JVM_MaxMemory + _JVM_MonitorNotify + _JVM_MonitorNotifyAll + _JVM_MonitorWait + _JVM_NanoTime + _JVM_NativePath + _JVM_NewArray + _JVM_NewInstanceFromConstructor + _JVM_NewMultiArray + _JVM_OnExit + _JVM_Open + _JVM_RaiseSignal + _JVM_RawMonitorCreate + _JVM_RawMonitorDestroy + _JVM_RawMonitorEnter + _JVM_RawMonitorExit + _JVM_Read + _JVM_Recv + _JVM_RecvFrom + _JVM_RegisterSignal + _JVM_ReleaseUTF + _JVM_ResolveClass + _JVM_ResumeThread + _JVM_Send + _JVM_SendTo + _JVM_SetArrayElement + _JVM_SetClassSigners + _JVM_SetLength + _JVM_SetNativeThreadName + _JVM_SetPrimitiveArrayElement + _JVM_SetSockOpt + _JVM_SetThreadPriority + _JVM_Sleep + _JVM_Socket + _JVM_SocketAvailable + _JVM_SocketClose + _JVM_SocketShutdown + _JVM_StartThread + _JVM_StopThread + _JVM_SuspendThread + _JVM_SupportsCX8 + _JVM_Sync + _JVM_Timeout + _JVM_TotalMemory + _JVM_TraceInstructions + _JVM_TraceMethodCalls + _JVM_UnloadLibrary + _JVM_Write + _JVM_Yield + _JVM_handle_bsd_signal + + # miscellaneous functions + _jio_fprintf + _jio_printf + _jio_snprintf + _jio_vfprintf + _jio_vsnprintf + + # This is for Forte Analyzer profiling support. + _AsyncGetCallTrace + + # INSERT VTABLE SYMBOLS HERE + diff -r 11985e4d4255 -r 303f79ab8e3d make/bsd/makefiles/mapfile-vers-debug --- a/make/bsd/makefiles/mapfile-vers-debug Mon Jan 27 07:54:25 2014 +0100 +++ b/make/bsd/makefiles/mapfile-vers-debug Sun Jan 26 23:01:57 2014 -0800 @@ -19,243 +19,250 @@ # 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. -# +# # -# Only used for OSX/Darwin builds # Define public interface. - # _JNI - _JNI_CreateJavaVM - _JNI_GetCreatedJavaVMs - _JNI_GetDefaultJavaVMInitArgs + +SUNWprivate_1.1 { + global: + # JNI + JNI_CreateJavaVM; + JNI_GetCreatedJavaVMs; + JNI_GetDefaultJavaVMInitArgs; - # _JVM - _JVM_Accept - _JVM_ActiveProcessorCount - _JVM_AllocateNewArray - _JVM_AllocateNewObject - _JVM_ArrayCopy - _JVM_AssertionStatusDirectives - _JVM_Available - _JVM_Bind - _JVM_ClassDepth - _JVM_ClassLoaderDepth - _JVM_Clone - _JVM_Close - _JVM_CX8Field - _JVM_CompileClass - _JVM_CompileClasses - _JVM_CompilerCommand - _JVM_Connect - _JVM_ConstantPoolGetClassAt - _JVM_ConstantPoolGetClassAtIfLoaded - _JVM_ConstantPoolGetDoubleAt - _JVM_ConstantPoolGetFieldAt - _JVM_ConstantPoolGetFieldAtIfLoaded - _JVM_ConstantPoolGetFloatAt - _JVM_ConstantPoolGetIntAt - _JVM_ConstantPoolGetLongAt - _JVM_ConstantPoolGetMethodAt - _JVM_ConstantPoolGetMethodAtIfLoaded - _JVM_ConstantPoolGetMemberRefInfoAt - _JVM_ConstantPoolGetSize - _JVM_ConstantPoolGetStringAt - _JVM_ConstantPoolGetUTF8At - _JVM_CountStackFrames - _JVM_CurrentClassLoader - _JVM_CurrentLoadedClass - _JVM_CurrentThread - _JVM_CurrentTimeMillis - _JVM_DefineClass - _JVM_DefineClassWithSource - _JVM_DefineClassWithSourceCond - _JVM_DesiredAssertionStatus - _JVM_DisableCompiler - _JVM_DoPrivileged - _JVM_DTraceGetVersion - _JVM_DTraceActivate - _JVM_DTraceIsProbeEnabled - _JVM_DTraceIsSupported - _JVM_DTraceDispose - _JVM_DumpAllStacks - _JVM_DumpThreads - _JVM_EnableCompiler - _JVM_Exit - _JVM_FillInStackTrace - _JVM_FindClassFromClass - _JVM_FindClassFromClassLoader - _JVM_FindClassFromBootLoader - _JVM_FindLibraryEntry - _JVM_FindLoadedClass - _JVM_FindPrimitiveClass - _JVM_FindSignal - _JVM_FreeMemory - _JVM_GC - _JVM_GetAllThreads - _JVM_GetArrayElement - _JVM_GetArrayLength - _JVM_GetCPClassNameUTF - _JVM_GetCPFieldClassNameUTF - _JVM_GetCPFieldModifiers - _JVM_GetCPFieldNameUTF - _JVM_GetCPFieldSignatureUTF - _JVM_GetCPMethodClassNameUTF - _JVM_GetCPMethodModifiers - _JVM_GetCPMethodNameUTF - _JVM_GetCPMethodSignatureUTF - _JVM_GetCallerClass - _JVM_GetClassAccessFlags - _JVM_GetClassAnnotations - _JVM_GetClassCPEntriesCount - _JVM_GetClassCPTypes - _JVM_GetClassConstantPool - _JVM_GetClassContext - _JVM_GetClassDeclaredConstructors - _JVM_GetClassDeclaredFields - _JVM_GetClassDeclaredMethods - _JVM_GetClassFieldsCount - _JVM_GetClassInterfaces - _JVM_GetClassLoader - _JVM_GetClassMethodsCount - _JVM_GetClassModifiers - _JVM_GetClassName - _JVM_GetClassNameUTF - _JVM_GetClassSignature - _JVM_GetClassSigners - _JVM_GetClassTypeAnnotations - _JVM_GetComponentType - _JVM_GetDeclaredClasses - _JVM_GetDeclaringClass - _JVM_GetEnclosingMethodInfo - _JVM_GetFieldAnnotations - _JVM_GetFieldIxModifiers - _JVM_GetFieldTypeAnnotations - _JVM_GetHostName - _JVM_GetInheritedAccessControlContext - _JVM_GetInterfaceVersion - _JVM_GetLastErrorString - _JVM_GetManagement - _JVM_GetMethodAnnotations - _JVM_GetMethodDefaultAnnotationValue - _JVM_GetMethodIxArgsSize - _JVM_GetMethodIxByteCode - _JVM_GetMethodIxByteCodeLength - _JVM_GetMethodIxExceptionIndexes - _JVM_GetMethodIxExceptionTableEntry - _JVM_GetMethodIxExceptionTableLength - _JVM_GetMethodIxExceptionsCount - _JVM_GetMethodIxLocalsCount - _JVM_GetMethodIxMaxStack - _JVM_GetMethodIxModifiers - _JVM_GetMethodIxNameUTF - _JVM_GetMethodIxSignatureUTF - _JVM_GetMethodParameterAnnotations - _JVM_GetMethodParameters - _JVM_GetMethodTypeAnnotations - _JVM_GetPrimitiveArrayElement - _JVM_GetProtectionDomain - _JVM_GetSockName - _JVM_GetSockOpt - _JVM_GetStackAccessControlContext - _JVM_GetStackTraceDepth - _JVM_GetStackTraceElement - _JVM_GetSystemPackage - _JVM_GetSystemPackages - _JVM_GetThreadStateNames - _JVM_GetThreadStateValues - _JVM_GetVersionInfo - _JVM_Halt - _JVM_HoldsLock - _JVM_IHashCode - _JVM_InitAgentProperties - _JVM_InitProperties - _JVM_InitializeCompiler - _JVM_InitializeSocketLibrary - _JVM_InternString - _JVM_Interrupt - _JVM_InvokeMethod - _JVM_IsArrayClass - _JVM_IsConstructorIx - _JVM_IsInterface - _JVM_IsInterrupted - _JVM_IsNaN - _JVM_IsPrimitiveClass - _JVM_IsSameClassPackage - _JVM_IsSilentCompiler - _JVM_IsSupportedJNIVersion - _JVM_IsThreadAlive - _JVM_IsVMGeneratedMethodIx - _JVM_LatestUserDefinedLoader - _JVM_Listen - _JVM_LoadClass0 - _JVM_LoadLibrary - _JVM_Lseek - _JVM_MaxObjectInspectionAge - _JVM_MaxMemory - _JVM_MonitorNotify - _JVM_MonitorNotifyAll - _JVM_MonitorWait - _JVM_NanoTime - _JVM_NativePath - _JVM_NewArray - _JVM_NewInstanceFromConstructor - _JVM_NewMultiArray - _JVM_OnExit - _JVM_Open - _JVM_RaiseSignal - _JVM_RawMonitorCreate - _JVM_RawMonitorDestroy - _JVM_RawMonitorEnter - _JVM_RawMonitorExit - _JVM_Read - _JVM_Recv - _JVM_RecvFrom - _JVM_RegisterSignal - _JVM_ReleaseUTF - _JVM_ResolveClass - _JVM_ResumeThread - _JVM_Send - _JVM_SendTo - _JVM_SetArrayElement - _JVM_SetClassSigners - _JVM_SetLength - _JVM_SetNativeThreadName - _JVM_SetPrimitiveArrayElement - _JVM_SetSockOpt - _JVM_SetThreadPriority - _JVM_Sleep - _JVM_Socket - _JVM_SocketAvailable - _JVM_SocketClose - _JVM_SocketShutdown - _JVM_StartThread - _JVM_StopThread - _JVM_SuspendThread - _JVM_SupportsCX8 - _JVM_Sync - _JVM_Timeout - _JVM_TotalMemory - _JVM_TraceInstructions - _JVM_TraceMethodCalls - _JVM_UnloadLibrary - _JVM_Write - _JVM_Yield - _JVM_handle_bsd_signal - - # debug _JVM - _JVM_AccessVMBooleanFlag - _JVM_AccessVMIntFlag - _JVM_VMBreakPoint + # JVM + JVM_Accept; + JVM_ActiveProcessorCount; + JVM_AllocateNewArray; + JVM_AllocateNewObject; + JVM_ArrayCopy; + JVM_AssertionStatusDirectives; + JVM_Available; + JVM_Bind; + JVM_ClassDepth; + JVM_ClassLoaderDepth; + JVM_Clone; + JVM_Close; + JVM_CX8Field; + JVM_CompileClass; + JVM_CompileClasses; + JVM_CompilerCommand; + JVM_Connect; + JVM_ConstantPoolGetClassAt; + JVM_ConstantPoolGetClassAtIfLoaded; + JVM_ConstantPoolGetDoubleAt; + JVM_ConstantPoolGetFieldAt; + JVM_ConstantPoolGetFieldAtIfLoaded; + JVM_ConstantPoolGetFloatAt; + JVM_ConstantPoolGetIntAt; + JVM_ConstantPoolGetLongAt; + JVM_ConstantPoolGetMethodAt; + JVM_ConstantPoolGetMethodAtIfLoaded; + JVM_ConstantPoolGetMemberRefInfoAt; + JVM_ConstantPoolGetSize; + JVM_ConstantPoolGetStringAt; + JVM_ConstantPoolGetUTF8At; + JVM_CountStackFrames; + JVM_CurrentClassLoader; + JVM_CurrentLoadedClass; + JVM_CurrentThread; + JVM_CurrentTimeMillis; + JVM_DefineClass; + JVM_DefineClassWithSource; + JVM_DefineClassWithSourceCond; + JVM_DesiredAssertionStatus; + JVM_DisableCompiler; + JVM_DoPrivileged; + JVM_DTraceGetVersion; + JVM_DTraceActivate; + JVM_DTraceIsProbeEnabled; + JVM_DTraceIsSupported; + JVM_DTraceDispose; + JVM_DumpAllStacks; + JVM_DumpThreads; + JVM_EnableCompiler; + JVM_Exit; + JVM_FillInStackTrace; + JVM_FindClassFromClass; + JVM_FindClassFromClassLoader; + JVM_FindClassFromBootLoader; + JVM_FindLibraryEntry; + JVM_FindLoadedClass; + JVM_FindPrimitiveClass; + JVM_FindSignal; + JVM_FreeMemory; + JVM_GC; + JVM_GetAllThreads; + JVM_GetArrayElement; + JVM_GetArrayLength; + JVM_GetCPClassNameUTF; + JVM_GetCPFieldClassNameUTF; + JVM_GetCPFieldModifiers; + JVM_GetCPFieldNameUTF; + JVM_GetCPFieldSignatureUTF; + JVM_GetCPMethodClassNameUTF; + JVM_GetCPMethodModifiers; + JVM_GetCPMethodNameUTF; + JVM_GetCPMethodSignatureUTF; + JVM_GetCallerClass; + JVM_GetClassAccessFlags; + JVM_GetClassAnnotations; + JVM_GetClassCPEntriesCount; + JVM_GetClassCPTypes; + JVM_GetClassConstantPool; + JVM_GetClassContext; + JVM_GetClassDeclaredConstructors; + JVM_GetClassDeclaredFields; + JVM_GetClassDeclaredMethods; + JVM_GetClassFieldsCount; + JVM_GetClassInterfaces; + JVM_GetClassLoader; + JVM_GetClassMethodsCount; + JVM_GetClassModifiers; + JVM_GetClassName; + JVM_GetClassNameUTF; + JVM_GetClassSignature; + JVM_GetClassSigners; + JVM_GetClassTypeAnnotations; + JVM_GetComponentType; + JVM_GetDeclaredClasses; + JVM_GetDeclaringClass; + JVM_GetEnclosingMethodInfo; + JVM_GetFieldAnnotations; + JVM_GetFieldIxModifiers; + JVM_GetFieldTypeAnnotations; + JVM_GetHostName; + JVM_GetInheritedAccessControlContext; + JVM_GetInterfaceVersion; + JVM_GetLastErrorString; + JVM_GetManagement; + JVM_GetMethodAnnotations; + JVM_GetMethodDefaultAnnotationValue; + JVM_GetMethodIxArgsSize; + JVM_GetMethodIxByteCode; + JVM_GetMethodIxByteCodeLength; + JVM_GetMethodIxExceptionIndexes; + JVM_GetMethodIxExceptionTableEntry; + JVM_GetMethodIxExceptionTableLength; + JVM_GetMethodIxExceptionsCount; + JVM_GetMethodIxLocalsCount; + JVM_GetMethodIxMaxStack; + JVM_GetMethodIxModifiers; + JVM_GetMethodIxNameUTF; + JVM_GetMethodIxSignatureUTF; + JVM_GetMethodParameterAnnotations; + JVM_GetMethodParameters; + JVM_GetMethodTypeAnnotations; + JVM_GetPrimitiveArrayElement; + JVM_GetProtectionDomain; + JVM_GetSockName; + JVM_GetSockOpt; + JVM_GetStackAccessControlContext; + JVM_GetStackTraceDepth; + JVM_GetStackTraceElement; + JVM_GetSystemPackage; + JVM_GetSystemPackages; + JVM_GetThreadStateNames; + JVM_GetThreadStateValues; + JVM_GetVersionInfo; + JVM_Halt; + JVM_HoldsLock; + JVM_IHashCode; + JVM_InitAgentProperties; + JVM_InitProperties; + JVM_InitializeCompiler; + JVM_InitializeSocketLibrary; + JVM_InternString; + JVM_Interrupt; + JVM_InvokeMethod; + JVM_IsArrayClass; + JVM_IsConstructorIx; + JVM_IsInterface; + JVM_IsInterrupted; + JVM_IsNaN; + JVM_IsPrimitiveClass; + JVM_IsSameClassPackage; + JVM_IsSilentCompiler; + JVM_IsSupportedJNIVersion; + JVM_IsThreadAlive; + JVM_IsVMGeneratedMethodIx; + JVM_LatestUserDefinedLoader; + JVM_Listen; + JVM_LoadClass0; + JVM_LoadLibrary; + JVM_Lseek; + JVM_MaxObjectInspectionAge; + JVM_MaxMemory; + JVM_MonitorNotify; + JVM_MonitorNotifyAll; + JVM_MonitorWait; + JVM_NanoTime; + JVM_NativePath; + JVM_NewArray; + JVM_NewInstanceFromConstructor; + JVM_NewMultiArray; + JVM_OnExit; + JVM_Open; + JVM_RaiseSignal; + JVM_RawMonitorCreate; + JVM_RawMonitorDestroy; + JVM_RawMonitorEnter; + JVM_RawMonitorExit; + JVM_Read; + JVM_Recv; + JVM_RecvFrom; + JVM_RegisterSignal; + JVM_ReleaseUTF; + JVM_ResolveClass; + JVM_ResumeThread; + JVM_Send; + JVM_SendTo; + JVM_SetArrayElement; + JVM_SetClassSigners; + JVM_SetLength; + JVM_SetNativeThreadName; + JVM_SetPrimitiveArrayElement; + JVM_SetSockOpt; + JVM_SetThreadPriority; + JVM_Sleep; + JVM_Socket; + JVM_SocketAvailable; + JVM_SocketClose; + JVM_SocketShutdown; + JVM_StartThread; + JVM_StopThread; + JVM_SuspendThread; + JVM_SupportsCX8; + JVM_Sync; + JVM_Timeout; + JVM_TotalMemory; + JVM_TraceInstructions; + JVM_TraceMethodCalls; + JVM_UnloadLibrary; + JVM_Write; + JVM_Yield; + JVM_handle_linux_signal; # miscellaneous functions - _jio_fprintf - _jio_printf - _jio_snprintf - _jio_vfprintf - _jio_vsnprintf + jio_fprintf; + jio_printf; + jio_snprintf; + jio_vfprintf; + jio_vsnprintf; + fork1; + numa_warn; + numa_error; + + # Needed because there is no JVM interface for this. + sysThreadAvailableStackWithSlack; # This is for Forte Analyzer profiling support. - _AsyncGetCallTrace + AsyncGetCallTrace; + + # INSERT VTABLE SYMBOLS HERE - # INSERT VTABLE SYMBOLS HERE + local: + *; +}; diff -r 11985e4d4255 -r 303f79ab8e3d make/bsd/makefiles/mapfile-vers-product --- a/make/bsd/makefiles/mapfile-vers-product Mon Jan 27 07:54:25 2014 +0100 +++ b/make/bsd/makefiles/mapfile-vers-product Sun Jan 26 23:01:57 2014 -0800 @@ -19,238 +19,250 @@ # 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. -# +# # -# Only used for OSX/Darwin builds # Define public interface. - # _JNI - _JNI_CreateJavaVM - _JNI_GetCreatedJavaVMs - _JNI_GetDefaultJavaVMInitArgs + +SUNWprivate_1.1 { + global: + # JNI + JNI_CreateJavaVM; + JNI_GetCreatedJavaVMs; + JNI_GetDefaultJavaVMInitArgs; - # _JVM - _JVM_Accept - _JVM_ActiveProcessorCount - _JVM_AllocateNewArray - _JVM_AllocateNewObject - _JVM_ArrayCopy - _JVM_AssertionStatusDirectives - _JVM_Available - _JVM_Bind - _JVM_ClassDepth - _JVM_ClassLoaderDepth - _JVM_Clone - _JVM_Close - _JVM_CX8Field - _JVM_CompileClass - _JVM_CompileClasses - _JVM_CompilerCommand - _JVM_Connect - _JVM_ConstantPoolGetClassAt - _JVM_ConstantPoolGetClassAtIfLoaded - _JVM_ConstantPoolGetDoubleAt - _JVM_ConstantPoolGetFieldAt - _JVM_ConstantPoolGetFieldAtIfLoaded - _JVM_ConstantPoolGetFloatAt - _JVM_ConstantPoolGetIntAt - _JVM_ConstantPoolGetLongAt - _JVM_ConstantPoolGetMethodAt - _JVM_ConstantPoolGetMethodAtIfLoaded - _JVM_ConstantPoolGetMemberRefInfoAt - _JVM_ConstantPoolGetSize - _JVM_ConstantPoolGetStringAt - _JVM_ConstantPoolGetUTF8At - _JVM_CountStackFrames - _JVM_CurrentClassLoader - _JVM_CurrentLoadedClass - _JVM_CurrentThread - _JVM_CurrentTimeMillis - _JVM_DefineClass - _JVM_DefineClassWithSource - _JVM_DefineClassWithSourceCond - _JVM_DesiredAssertionStatus - _JVM_DisableCompiler - _JVM_DoPrivileged - _JVM_DTraceGetVersion - _JVM_DTraceActivate - _JVM_DTraceIsProbeEnabled - _JVM_DTraceIsSupported - _JVM_DTraceDispose - _JVM_DumpAllStacks - _JVM_DumpThreads - _JVM_EnableCompiler - _JVM_Exit - _JVM_FillInStackTrace - _JVM_FindClassFromClass - _JVM_FindClassFromClassLoader - _JVM_FindClassFromBootLoader - _JVM_FindLibraryEntry - _JVM_FindLoadedClass - _JVM_FindPrimitiveClass - _JVM_FindSignal - _JVM_FreeMemory - _JVM_GC - _JVM_GetAllThreads - _JVM_GetArrayElement - _JVM_GetArrayLength - _JVM_GetCPClassNameUTF - _JVM_GetCPFieldClassNameUTF - _JVM_GetCPFieldModifiers - _JVM_GetCPFieldNameUTF - _JVM_GetCPFieldSignatureUTF - _JVM_GetCPMethodClassNameUTF - _JVM_GetCPMethodModifiers - _JVM_GetCPMethodNameUTF - _JVM_GetCPMethodSignatureUTF - _JVM_GetCallerClass - _JVM_GetClassAccessFlags - _JVM_GetClassAnnotations - _JVM_GetClassCPEntriesCount - _JVM_GetClassCPTypes - _JVM_GetClassConstantPool - _JVM_GetClassContext - _JVM_GetClassDeclaredConstructors - _JVM_GetClassDeclaredFields - _JVM_GetClassDeclaredMethods - _JVM_GetClassFieldsCount - _JVM_GetClassInterfaces - _JVM_GetClassLoader - _JVM_GetClassMethodsCount - _JVM_GetClassModifiers - _JVM_GetClassName - _JVM_GetClassNameUTF - _JVM_GetClassSignature - _JVM_GetClassSigners - _JVM_GetClassTypeAnnotations - _JVM_GetComponentType - _JVM_GetDeclaredClasses - _JVM_GetDeclaringClass - _JVM_GetEnclosingMethodInfo - _JVM_GetFieldAnnotations - _JVM_GetFieldIxModifiers - _JVM_GetFieldTypeAnnotations - _JVM_GetHostName - _JVM_GetInheritedAccessControlContext - _JVM_GetInterfaceVersion - _JVM_GetLastErrorString - _JVM_GetManagement - _JVM_GetMethodAnnotations - _JVM_GetMethodDefaultAnnotationValue - _JVM_GetMethodIxArgsSize - _JVM_GetMethodIxByteCode - _JVM_GetMethodIxByteCodeLength - _JVM_GetMethodIxExceptionIndexes - _JVM_GetMethodIxExceptionTableEntry - _JVM_GetMethodIxExceptionTableLength - _JVM_GetMethodIxExceptionsCount - _JVM_GetMethodIxLocalsCount - _JVM_GetMethodIxMaxStack - _JVM_GetMethodIxModifiers - _JVM_GetMethodIxNameUTF - _JVM_GetMethodIxSignatureUTF - _JVM_GetMethodParameterAnnotations - _JVM_GetMethodParameters - _JVM_GetMethodTypeAnnotations - _JVM_GetPrimitiveArrayElement - _JVM_GetProtectionDomain - _JVM_GetSockName - _JVM_GetSockOpt - _JVM_GetStackAccessControlContext - _JVM_GetStackTraceDepth - _JVM_GetStackTraceElement - _JVM_GetSystemPackage - _JVM_GetSystemPackages - _JVM_GetThreadStateNames - _JVM_GetThreadStateValues - _JVM_GetVersionInfo - _JVM_Halt - _JVM_HoldsLock - _JVM_IHashCode - _JVM_InitAgentProperties - _JVM_InitProperties - _JVM_InitializeCompiler - _JVM_InitializeSocketLibrary - _JVM_InternString - _JVM_Interrupt - _JVM_InvokeMethod - _JVM_IsArrayClass - _JVM_IsConstructorIx - _JVM_IsInterface - _JVM_IsInterrupted - _JVM_IsNaN - _JVM_IsPrimitiveClass - _JVM_IsSameClassPackage - _JVM_IsSilentCompiler - _JVM_IsSupportedJNIVersion - _JVM_IsThreadAlive - _JVM_IsVMGeneratedMethodIx - _JVM_LatestUserDefinedLoader - _JVM_Listen - _JVM_LoadClass0 - _JVM_LoadLibrary - _JVM_Lseek - _JVM_MaxObjectInspectionAge - _JVM_MaxMemory - _JVM_MonitorNotify - _JVM_MonitorNotifyAll - _JVM_MonitorWait - _JVM_NanoTime - _JVM_NativePath - _JVM_NewArray - _JVM_NewInstanceFromConstructor - _JVM_NewMultiArray - _JVM_OnExit - _JVM_Open - _JVM_RaiseSignal - _JVM_RawMonitorCreate - _JVM_RawMonitorDestroy - _JVM_RawMonitorEnter - _JVM_RawMonitorExit - _JVM_Read - _JVM_Recv - _JVM_RecvFrom - _JVM_RegisterSignal - _JVM_ReleaseUTF - _JVM_ResolveClass - _JVM_ResumeThread - _JVM_Send - _JVM_SendTo - _JVM_SetArrayElement - _JVM_SetClassSigners - _JVM_SetLength - _JVM_SetNativeThreadName - _JVM_SetPrimitiveArrayElement - _JVM_SetSockOpt - _JVM_SetThreadPriority - _JVM_Sleep - _JVM_Socket - _JVM_SocketAvailable - _JVM_SocketClose - _JVM_SocketShutdown - _JVM_StartThread - _JVM_StopThread - _JVM_SuspendThread - _JVM_SupportsCX8 - _JVM_Sync - _JVM_Timeout - _JVM_TotalMemory - _JVM_TraceInstructions - _JVM_TraceMethodCalls - _JVM_UnloadLibrary - _JVM_Write - _JVM_Yield - _JVM_handle_bsd_signal + # JVM + JVM_Accept; + JVM_ActiveProcessorCount; + JVM_AllocateNewArray; + JVM_AllocateNewObject; + JVM_ArrayCopy; + JVM_AssertionStatusDirectives; + JVM_Available; + JVM_Bind; + JVM_ClassDepth; + JVM_ClassLoaderDepth; + JVM_Clone; + JVM_Close; + JVM_CX8Field; + JVM_CompileClass; + JVM_CompileClasses; + JVM_CompilerCommand; + JVM_Connect; + JVM_ConstantPoolGetClassAt; + JVM_ConstantPoolGetClassAtIfLoaded; + JVM_ConstantPoolGetDoubleAt; + JVM_ConstantPoolGetFieldAt; + JVM_ConstantPoolGetFieldAtIfLoaded; + JVM_ConstantPoolGetFloatAt; + JVM_ConstantPoolGetIntAt; + JVM_ConstantPoolGetLongAt; + JVM_ConstantPoolGetMethodAt; + JVM_ConstantPoolGetMethodAtIfLoaded; + JVM_ConstantPoolGetMemberRefInfoAt; + JVM_ConstantPoolGetSize; + JVM_ConstantPoolGetStringAt; + JVM_ConstantPoolGetUTF8At; + JVM_CountStackFrames; + JVM_CurrentClassLoader; + JVM_CurrentLoadedClass; + JVM_CurrentThread; + JVM_CurrentTimeMillis; + JVM_DefineClass; + JVM_DefineClassWithSource; + JVM_DefineClassWithSourceCond; + JVM_DesiredAssertionStatus; + JVM_DisableCompiler; + JVM_DoPrivileged; + JVM_DTraceGetVersion; + JVM_DTraceActivate; + JVM_DTraceIsProbeEnabled; + JVM_DTraceIsSupported; + JVM_DTraceDispose; + JVM_DumpAllStacks; + JVM_DumpThreads; + JVM_EnableCompiler; + JVM_Exit; + JVM_FillInStackTrace; + JVM_FindClassFromClass; + JVM_FindClassFromClassLoader; + JVM_FindClassFromBootLoader; + JVM_FindLibraryEntry; + JVM_FindLoadedClass; + JVM_FindPrimitiveClass; + JVM_FindSignal; + JVM_FreeMemory; + JVM_GC; + JVM_GetAllThreads; + JVM_GetArrayElement; + JVM_GetArrayLength; + JVM_GetCPClassNameUTF; + JVM_GetCPFieldClassNameUTF; + JVM_GetCPFieldModifiers; + JVM_GetCPFieldNameUTF; + JVM_GetCPFieldSignatureUTF; + JVM_GetCPMethodClassNameUTF; + JVM_GetCPMethodModifiers; + JVM_GetCPMethodNameUTF; + JVM_GetCPMethodSignatureUTF; + JVM_GetCallerClass; + JVM_GetClassAccessFlags; + JVM_GetClassAnnotations; + JVM_GetClassCPEntriesCount; + JVM_GetClassCPTypes; + JVM_GetClassConstantPool; + JVM_GetClassContext; + JVM_GetClassDeclaredConstructors; + JVM_GetClassDeclaredFields; + JVM_GetClassDeclaredMethods; + JVM_GetClassFieldsCount; + JVM_GetClassInterfaces; + JVM_GetClassLoader; + JVM_GetClassMethodsCount; + JVM_GetClassModifiers; + JVM_GetClassName; + JVM_GetClassNameUTF; + JVM_GetClassSignature; + JVM_GetClassSigners; + JVM_GetClassTypeAnnotations; + JVM_GetComponentType; + JVM_GetDeclaredClasses; + JVM_GetDeclaringClass; + JVM_GetEnclosingMethodInfo; + JVM_GetFieldAnnotations; + JVM_GetFieldIxModifiers; + JVM_GetFieldTypeAnnotations; + JVM_GetHostName; + JVM_GetInheritedAccessControlContext; + JVM_GetInterfaceVersion; + JVM_GetLastErrorString; + JVM_GetManagement; + JVM_GetMethodAnnotations; + JVM_GetMethodDefaultAnnotationValue; + JVM_GetMethodIxArgsSize; + JVM_GetMethodIxByteCode; + JVM_GetMethodIxByteCodeLength; + JVM_GetMethodIxExceptionIndexes; + JVM_GetMethodIxExceptionTableEntry; + JVM_GetMethodIxExceptionTableLength; + JVM_GetMethodIxExceptionsCount; + JVM_GetMethodIxLocalsCount; + JVM_GetMethodIxMaxStack; + JVM_GetMethodIxModifiers; + JVM_GetMethodIxNameUTF; + JVM_GetMethodIxSignatureUTF; + JVM_GetMethodParameterAnnotations; + JVM_GetMethodParameters; + JVM_GetMethodTypeAnnotations; + JVM_GetPrimitiveArrayElement; + JVM_GetProtectionDomain; + JVM_GetSockName; + JVM_GetSockOpt; + JVM_GetStackAccessControlContext; + JVM_GetStackTraceDepth; + JVM_GetStackTraceElement; + JVM_GetSystemPackage; + JVM_GetSystemPackages; + JVM_GetThreadStateNames; + JVM_GetThreadStateValues; + JVM_GetVersionInfo; + JVM_Halt; + JVM_HoldsLock; + JVM_IHashCode; + JVM_InitAgentProperties; + JVM_InitProperties; + JVM_InitializeCompiler; + JVM_InitializeSocketLibrary; + JVM_InternString; + JVM_Interrupt; + JVM_InvokeMethod; + JVM_IsArrayClass; + JVM_IsConstructorIx; + JVM_IsInterface; + JVM_IsInterrupted; + JVM_IsNaN; + JVM_IsPrimitiveClass; + JVM_IsSameClassPackage; + JVM_IsSilentCompiler; + JVM_IsSupportedJNIVersion; + JVM_IsThreadAlive; + JVM_IsVMGeneratedMethodIx; + JVM_LatestUserDefinedLoader; + JVM_Listen; + JVM_LoadClass0; + JVM_LoadLibrary; + JVM_Lseek; + JVM_MaxObjectInspectionAge; + JVM_MaxMemory; + JVM_MonitorNotify; + JVM_MonitorNotifyAll; + JVM_MonitorWait; + JVM_NanoTime; + JVM_NativePath; + JVM_NewArray; + JVM_NewInstanceFromConstructor; + JVM_NewMultiArray; + JVM_OnExit; + JVM_Open; + JVM_RaiseSignal; + JVM_RawMonitorCreate; + JVM_RawMonitorDestroy; + JVM_RawMonitorEnter; + JVM_RawMonitorExit; + JVM_Read; + JVM_Recv; + JVM_RecvFrom; + JVM_RegisterSignal; + JVM_ReleaseUTF; + JVM_ResolveClass; + JVM_ResumeThread; + JVM_Send; + JVM_SendTo; + JVM_SetArrayElement; + JVM_SetClassSigners; + JVM_SetLength; + JVM_SetNativeThreadName; + JVM_SetPrimitiveArrayElement; + JVM_SetSockOpt; + JVM_SetThreadPriority; + JVM_Sleep; + JVM_Socket; + JVM_SocketAvailable; + JVM_SocketClose; + JVM_SocketShutdown; + JVM_StartThread; + JVM_StopThread; + JVM_SuspendThread; + JVM_SupportsCX8; + JVM_Sync; + JVM_Timeout; + JVM_TotalMemory; + JVM_TraceInstructions; + JVM_TraceMethodCalls; + JVM_UnloadLibrary; + JVM_Write; + JVM_Yield; + JVM_handle_linux_signal; # miscellaneous functions - _jio_fprintf - _jio_printf - _jio_snprintf - _jio_vfprintf - _jio_vsnprintf + jio_fprintf; + jio_printf; + jio_snprintf; + jio_vfprintf; + jio_vsnprintf; + fork1; + numa_warn; + numa_error; + + # Needed because there is no JVM interface for this. + sysThreadAvailableStackWithSlack; # This is for Forte Analyzer profiling support. - _AsyncGetCallTrace + AsyncGetCallTrace; + + # INSERT VTABLE SYMBOLS HERE - # INSERT VTABLE SYMBOLS HERE + local: + *; +}; diff -r 11985e4d4255 -r 303f79ab8e3d make/bsd/makefiles/optimized.make --- a/make/bsd/makefiles/optimized.make Mon Jan 27 07:54:25 2014 +0100 +++ b/make/bsd/makefiles/optimized.make Sun Jan 26 23:01:57 2014 -0800 @@ -39,5 +39,8 @@ # Linker mapfile MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug +ifeq ($(OS_VENDOR), Darwin) +MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-darwin-debug +endif VERSION = optimized diff -r 11985e4d4255 -r 303f79ab8e3d make/bsd/makefiles/product.make --- a/make/bsd/makefiles/product.make Mon Jan 27 07:54:25 2014 +0100 +++ b/make/bsd/makefiles/product.make Sun Jan 26 23:01:57 2014 -0800 @@ -39,6 +39,9 @@ # Linker mapfile MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-product +ifeq ($(OS_VENDOR), Darwin) +MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-darwin-product +endif SYSDEFS += -DPRODUCT VERSION = optimized diff -r 11985e4d4255 -r 303f79ab8e3d make/linux/makefiles/adjust-mflags.sh --- a/make/linux/makefiles/adjust-mflags.sh Mon Jan 27 07:54:25 2014 +0100 +++ b/make/linux/makefiles/adjust-mflags.sh Sun Jan 26 23:01:57 2014 -0800 @@ -64,7 +64,7 @@ echo "$MFLAGS" \ | sed ' s/^-/ -/ - s/ -\([^ ][^ ]*\)j/ -\1 -j/ + s/ -\([^ I][^ I]*\)j/ -\1 -j/ s/ -j[0-9][0-9]*/ -j/ s/ -j\([^ ]\)/ -j -\1/ s/ -j/ -j'${HOTSPOT_BUILD_JOBS:-${default_build_jobs}}'/ diff -r 11985e4d4255 -r 303f79ab8e3d make/linux/makefiles/mapfile-vers-debug --- a/make/linux/makefiles/mapfile-vers-debug Mon Jan 27 07:54:25 2014 +0100 +++ b/make/linux/makefiles/mapfile-vers-debug Sun Jan 26 23:01:57 2014 -0800 @@ -244,11 +244,6 @@ JVM_Yield; JVM_handle_linux_signal; - # debug JVM - JVM_AccessVMBooleanFlag; - JVM_AccessVMIntFlag; - JVM_VMBreakPoint; - # miscellaneous functions jio_fprintf; jio_printf; diff -r 11985e4d4255 -r 303f79ab8e3d make/solaris/makefiles/adjust-mflags.sh --- a/make/solaris/makefiles/adjust-mflags.sh Mon Jan 27 07:54:25 2014 +0100 +++ b/make/solaris/makefiles/adjust-mflags.sh Sun Jan 26 23:01:57 2014 -0800 @@ -64,7 +64,7 @@ echo "$MFLAGS" \ | sed ' s/^-/ -/ - s/ -\([^ ][^ ]*\)j/ -\1 -j/ + s/ -\([^ I][^ I]*\)j/ -\1 -j/ s/ -j[0-9][0-9]*/ -j/ s/ -j\([^ ]\)/ -j -\1/ s/ -j/ -j'${HOTSPOT_BUILD_JOBS:-${default_build_jobs}}'/ diff -r 11985e4d4255 -r 303f79ab8e3d make/solaris/makefiles/mapfile-vers-debug --- a/make/solaris/makefiles/mapfile-vers-debug Mon Jan 27 07:54:25 2014 +0100 +++ b/make/solaris/makefiles/mapfile-vers-debug Sun Jan 26 23:01:57 2014 -0800 @@ -28,10 +28,6 @@ SUNWprivate_1.1 { global: - # debug JVM - JVM_AccessVMBooleanFlag; - JVM_AccessVMIntFlag; - JVM_VMBreakPoint; # miscellaneous }; diff -r 11985e4d4255 -r 303f79ab8e3d make/windows/makefiles/sa.make --- a/make/windows/makefiles/sa.make Mon Jan 27 07:54:25 2014 +0100 +++ b/make/windows/makefiles/sa.make Sun Jan 26 23:01:57 2014 -0800 @@ -94,7 +94,7 @@ SA_LD_FLAGS = bufferoverflowU.lib !endif !else -SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 -Gm $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -GZ -c +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -RTC1 -c !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" SA_CFLAGS = $(SA_CFLAGS) -ZI !endif diff -r 11985e4d4255 -r 303f79ab8e3d src/os/bsd/dtrace/hotspot.d --- a/src/os/bsd/dtrace/hotspot.d Mon Jan 27 07:54:25 2014 +0100 +++ b/src/os/bsd/dtrace/hotspot.d Sun Jan 26 23:01:57 2014 -0800 @@ -47,8 +47,8 @@ probe mem__pool__gc__end( char*, uintptr_t, char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); - probe thread__probe__start(char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t); - probe thread__probe__stop(char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t); + probe thread__start(char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t); + probe thread__stop(char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t); probe thread__sleep__begin(long long); probe thread__sleep__end(int); probe thread__yield(); @@ -68,7 +68,7 @@ probe monitor__contended__entered(uintptr_t, uintptr_t, char*, uintptr_t); probe monitor__contended__exit(uintptr_t, uintptr_t, char*, uintptr_t); probe monitor__wait(uintptr_t, uintptr_t, char*, uintptr_t, uintptr_t); - probe monitor__probe__waited(uintptr_t, uintptr_t, char*, uintptr_t); + probe monitor__waited(uintptr_t, uintptr_t, char*, uintptr_t); probe monitor__notify(uintptr_t, uintptr_t, char*, uintptr_t); probe monitor__notifyAll(uintptr_t, uintptr_t, char*, uintptr_t); diff -r 11985e4d4255 -r 303f79ab8e3d src/os/windows/vm/os_windows.cpp --- a/src/os/windows/vm/os_windows.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/os/windows/vm/os_windows.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -166,12 +166,10 @@ return; } -#ifndef _WIN64 // previous UnhandledExceptionFilter, if there is one static LPTOP_LEVEL_EXCEPTION_FILTER prev_uef_handler = NULL; LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo); -#endif void os::init_system_properties_values() { /* sysclasspath, java_home, dll_dir */ { @@ -2240,11 +2238,11 @@ return EXCEPTION_CONTINUE_EXECUTION; } -#ifndef _WIN64 //----------------------------------------------------------------------------- LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) { + PCONTEXT ctx = exceptionInfo->ContextRecord; +#ifndef _WIN64 // handle exception caused by native method modifying control word - PCONTEXT ctx = exceptionInfo->ContextRecord; DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode; switch (exception_code) { @@ -2270,17 +2268,11 @@ // UnhandledExceptionFilter. return (prev_uef_handler)(exceptionInfo); } - - return EXCEPTION_CONTINUE_SEARCH; -} -#else //_WIN64 +#else // !_WIN64 /* On Windows, the mxcsr control bits are non-volatile across calls See also CR 6192333 - If EXCEPTION_FLT_* happened after some native method modified - mxcsr - it is not a jvm fault. - However should we decide to restore of mxcsr after a faulty - native method we can uncomment following code + */ jint MxCsr = INITIAL_MXCSR; // we can't use StubRoutines::addr_mxcsr_std() // because in Win64 mxcsr is not saved there @@ -2288,10 +2280,10 @@ ctx->MxCsr = MxCsr; return EXCEPTION_CONTINUE_EXECUTION; } - -*/ -#endif //_WIN64 - +#endif // !_WIN64 + + return EXCEPTION_CONTINUE_SEARCH; +} // Fatal error reporting is single threaded so we can make this a // static and preallocated. If it's more than MAX_PATH silently ignore @@ -2640,7 +2632,6 @@ } // switch } -#ifndef _WIN64 if (((thread->thread_state() == _thread_in_Java) || (thread->thread_state() == _thread_in_native)) && exception_code != EXCEPTION_UNCAUGHT_CXX_EXCEPTION) @@ -2648,7 +2639,6 @@ LONG result=Handle_FLT_Exception(exceptionInfo); if (result==EXCEPTION_CONTINUE_EXECUTION) return result; } -#endif //_WIN64 } if (exception_code != EXCEPTION_BREAKPOINT) { diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/classfile/classFileParser.cpp --- a/src/share/vm/classfile/classFileParser.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/classfile/classFileParser.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -4098,8 +4098,12 @@ tty->print("[Loaded %s from %s]\n", this_klass->external_name(), cfs->source()); } else if (class_loader.is_null()) { - if (THREAD->is_Java_thread()) { - Klass* caller = ((JavaThread*)THREAD)->security_get_caller_class(1); + Klass* caller = + THREAD->is_Java_thread() + ? ((JavaThread*)THREAD)->security_get_caller_class(1) + : NULL; + // caller can be NULL, for example, during a JVMTI VM_Init hook + if (caller != NULL) { tty->print("[Loaded %s by instance of %s]\n", this_klass->external_name(), InstanceKlass::cast(caller)->external_name()); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/classfile/classLoaderData.cpp --- a/src/share/vm/classfile/classLoaderData.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/classfile/classLoaderData.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -648,12 +648,12 @@ return array; } -#ifndef PRODUCT -// for debugging and hsfind(x) -bool ClassLoaderDataGraph::contains(address x) { - // I think we need the _metaspace_lock taken here because the class loader - // data graph could be changing while we are walking it (new entries added, - // new entries being unloaded, etc). +// For profiling and hsfind() only. Otherwise, this is unsafe (and slow). This +// is done lock free to avoid lock inversion problems. It is safe because +// new ClassLoaderData are added to the end of the CLDG, and only removed at +// safepoint. The _unloading list can be deallocated concurrently with CMS so +// this doesn't look in metaspace for classes that have been unloaded. +bool ClassLoaderDataGraph::contains(const void* x) { if (DumpSharedSpaces) { // There are only two metaspaces to worry about. ClassLoaderData* ncld = ClassLoaderData::the_null_class_loader_data(); @@ -670,16 +670,11 @@ } } - // Could also be on an unloading list which is okay, ie. still allocated - // for a little while. - for (ClassLoaderData* ucld = _unloading; ucld != NULL; ucld = ucld->next()) { - if (ucld->metaspace_or_null() != NULL && ucld->metaspace_or_null()->contains(x)) { - return true; - } - } + // Do not check unloading list because deallocation can be concurrent. return false; } +#ifndef PRODUCT bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) { for (ClassLoaderData* data = _head; data != NULL; data = data->next()) { if (loader_data == data) { diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/classfile/classLoaderData.hpp --- a/src/share/vm/classfile/classLoaderData.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/classfile/classLoaderData.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -90,9 +90,9 @@ static void dump() { dump_on(tty); } static void verify(); + // expensive test for pointer in metaspace for debugging + static bool contains(const void* x); #ifndef PRODUCT - // expensive test for pointer in metaspace for debugging - static bool contains(address x); static bool contains_loader_data(ClassLoaderData* loader_data); #endif diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/classfile/defaultMethods.cpp --- a/src/share/vm/classfile/defaultMethods.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/classfile/defaultMethods.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -390,6 +390,20 @@ Symbol* get_exception_message() { return _exception_message; } Symbol* get_exception_name() { return _exception_name; } + // Return true if the specified klass has a static method that matches + // the name and signature of the target method. + bool has_matching_static(InstanceKlass* root) { + if (_members.length() > 0) { + Pair entry = _members.at(0); + Method* impl = root->find_method(entry.first->name(), + entry.first->signature()); + if ((impl != NULL) && impl->is_static()) { + return true; + } + } + return false; + } + // Either sets the target or the exception error message void determine_target(InstanceKlass* root, TRAPS) { if (has_target() || throws_exception()) { @@ -416,19 +430,26 @@ } if (num_defaults == 0) { - if (qualified_methods.length() == 0) { - _exception_message = generate_no_defaults_message(CHECK); - } else { - assert(root != NULL, "Null root class"); - _exception_message = generate_method_message(root->name(), qualified_methods.at(0), CHECK); + // If the root klass has a static method with matching name and signature + // then do not generate an overpass method because it will hide the + // static method during resolution. + if (!has_matching_static(root)) { + if (qualified_methods.length() == 0) { + _exception_message = generate_no_defaults_message(CHECK); + } else { + assert(root != NULL, "Null root class"); + _exception_message = generate_method_message(root->name(), qualified_methods.at(0), CHECK); + } + _exception_name = vmSymbols::java_lang_AbstractMethodError(); } - _exception_name = vmSymbols::java_lang_AbstractMethodError(); + // If only one qualified method is default, select that } else if (num_defaults == 1) { _selected_target = qualified_methods.at(default_index); - } else if (num_defaults > 1) { - _exception_message = generate_conflicts_message(&qualified_methods,CHECK); - _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); + + } else if (num_defaults > 1 && !has_matching_static(root)) { + _exception_message = generate_conflicts_message(&qualified_methods,CHECK); + _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); if (TraceDefaultMethods) { _exception_message->print_value_on(tty); tty->print_cr(""); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/classfile/javaClasses.cpp --- a/src/share/vm/classfile/javaClasses.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/classfile/javaClasses.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -3286,7 +3286,7 @@ sun_reflect_ConstantPool::compute_offsets(); sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets(); } - if (JDK_Version::is_jdk18x_version()) + if (JDK_Version::is_gte_jdk18x_version()) java_lang_reflect_Parameter::compute_offsets(); // generated interpreter code wants to know about the offsets we just computed: diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/code/dependencies.cpp --- a/src/share/vm/code/dependencies.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/code/dependencies.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -655,8 +655,6 @@ } else { o = _deps->oop_recorder()->metadata_at(i); } - assert(o == NULL || o->is_metaspace_object(), - err_msg("Should be metadata " PTR_FORMAT, o)); return o; } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -2376,25 +2376,6 @@ return blk.result(); } -size_t G1CollectedHeap::unsafe_max_alloc() { - if (free_regions() > 0) return HeapRegion::GrainBytes; - // otherwise, is there space in the current allocation region? - - // We need to store the current allocation region in a local variable - // here. The problem is that this method doesn't take any locks and - // there may be other threads which overwrite the current allocation - // region field. attempt_allocation(), for example, sets it to NULL - // and this can happen *after* the NULL check here but before the call - // to free(), resulting in a SIGSEGV. Note that this doesn't appear - // to be a problem in the optimized build, since the two loads of the - // current allocation region field are optimized away. - HeapRegion* hr = _mutator_alloc_region.get(); - if (hr == NULL) { - return 0; - } - return hr->free(); -} - bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) { switch (cause) { case GCCause::_gc_locker: return GCLockerInvokesConcurrent; diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -1183,15 +1183,6 @@ // end fields defining the extent of the contiguous allocation region.) // But G1CollectedHeap doesn't yet support this. - // Return an estimate of the maximum allocation that could be performed - // without triggering any collection or expansion activity. In a - // generational collector, for example, this is probably the largest - // allocation that could be supported (without expansion) in the youngest - // generation. It is "unsafe" because no locks are taken; the result - // should be treated as an approximation, not a guarantee, for use in - // heuristic resizing decisions. - virtual size_t unsafe_max_alloc(); - virtual bool is_maximal_no_gc() const { return _g1_storage.uncommitted_size() == 0; } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/gc_implementation/g1/satbQueue.cpp --- a/src/share/vm/gc_implementation/g1/satbQueue.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/gc_implementation/g1/satbQueue.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -219,58 +219,52 @@ } #ifdef ASSERT -void SATBMarkQueueSet::dump_active_values(JavaThread* first, - bool expected_active) { - gclog_or_tty->print_cr("SATB queue active values for Java Threads"); - gclog_or_tty->print_cr(" SATB queue set: active is %s", - (is_active()) ? "TRUE" : "FALSE"); - gclog_or_tty->print_cr(" expected_active is %s", - (expected_active) ? "TRUE" : "FALSE"); - for (JavaThread* t = first; t; t = t->next()) { - bool active = t->satb_mark_queue().is_active(); - gclog_or_tty->print_cr(" thread %s, active is %s", - t->name(), (active) ? "TRUE" : "FALSE"); +void SATBMarkQueueSet::dump_active_states(bool expected_active) { + gclog_or_tty->print_cr("Expected SATB active state: %s", + expected_active ? "ACTIVE" : "INACTIVE"); + gclog_or_tty->print_cr("Actual SATB active states:"); + gclog_or_tty->print_cr(" Queue set: %s", is_active() ? "ACTIVE" : "INACTIVE"); + for (JavaThread* t = Threads::first(); t; t = t->next()) { + gclog_or_tty->print_cr(" Thread \"%s\" queue: %s", t->name(), + t->satb_mark_queue().is_active() ? "ACTIVE" : "INACTIVE"); + } + gclog_or_tty->print_cr(" Shared queue: %s", + shared_satb_queue()->is_active() ? "ACTIVE" : "INACTIVE"); +} + +void SATBMarkQueueSet::verify_active_states(bool expected_active) { + // Verify queue set state + if (is_active() != expected_active) { + dump_active_states(expected_active); + guarantee(false, "SATB queue set has an unexpected active state"); + } + + // Verify thread queue states + for (JavaThread* t = Threads::first(); t; t = t->next()) { + if (t->satb_mark_queue().is_active() != expected_active) { + dump_active_states(expected_active); + guarantee(false, "Thread SATB queue has an unexpected active state"); + } + } + + // Verify shared queue state + if (shared_satb_queue()->is_active() != expected_active) { + dump_active_states(expected_active); + guarantee(false, "Shared SATB queue has an unexpected active state"); } } #endif // ASSERT -void SATBMarkQueueSet::set_active_all_threads(bool b, - bool expected_active) { +void SATBMarkQueueSet::set_active_all_threads(bool active, bool expected_active) { assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint."); - JavaThread* first = Threads::first(); - #ifdef ASSERT - if (_all_active != expected_active) { - dump_active_values(first, expected_active); - - // I leave this here as a guarantee, instead of an assert, so - // that it will still be compiled in if we choose to uncomment - // the #ifdef ASSERT in a product build. The whole block is - // within an #ifdef ASSERT so the guarantee will not be compiled - // in a product build anyway. - guarantee(false, - "SATB queue set has an unexpected active value"); - } + verify_active_states(expected_active); #endif // ASSERT - _all_active = b; - - for (JavaThread* t = first; t; t = t->next()) { -#ifdef ASSERT - bool active = t->satb_mark_queue().is_active(); - if (active != expected_active) { - dump_active_values(first, expected_active); - - // I leave this here as a guarantee, instead of an assert, so - // that it will still be compiled in if we choose to uncomment - // the #ifdef ASSERT in a product build. The whole block is - // within an #ifdef ASSERT so the guarantee will not be compiled - // in a product build anyway. - guarantee(false, - "thread has an unexpected active value in its SATB queue"); - } -#endif // ASSERT - t->satb_mark_queue().set_active(b); + _all_active = active; + for (JavaThread* t = Threads::first(); t; t = t->next()) { + t->satb_mark_queue().set_active(active); } + shared_satb_queue()->set_active(active); } void SATBMarkQueueSet::filter_thread_buffers() { diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/gc_implementation/g1/satbQueue.hpp --- a/src/share/vm/gc_implementation/g1/satbQueue.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/gc_implementation/g1/satbQueue.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -87,7 +87,8 @@ bool apply_closure_to_completed_buffer_work(bool par, int worker); #ifdef ASSERT - void dump_active_values(JavaThread* first, bool expected_active); + void dump_active_states(bool expected_active); + void verify_active_states(bool expected_active); #endif // ASSERT public: @@ -99,11 +100,11 @@ static void handle_zero_index_for_thread(JavaThread* t); - // Apply "set_active(b)" to all Java threads' SATB queues. It should be + // Apply "set_active(active)" to all SATB queues in the set. It should be // called only with the world stopped. The method will assert that the // SATB queues of all threads it visits, as well as the SATB queue // set itself, has an active value same as expected_active. - void set_active_all_threads(bool b, bool expected_active); + void set_active_all_threads(bool active, bool expected_active); // Filter all the currently-active SATB buffers. void filter_thread_buffers(); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp --- a/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -484,10 +484,6 @@ young_gen()->eden_space()->ensure_parsability(); } -size_t ParallelScavengeHeap::unsafe_max_alloc() { - return young_gen()->eden_space()->free_in_bytes(); -} - size_t ParallelScavengeHeap::tlab_capacity(Thread* thr) const { return young_gen()->eden_space()->tlab_capacity(thr); } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp --- a/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -184,8 +184,6 @@ void accumulate_statistics_all_tlabs(); void resize_all_tlabs(); - size_t unsafe_max_alloc(); - bool supports_tlab_allocation() const { return true; } size_t tlab_capacity(Thread* thr) const; diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp --- a/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -466,10 +466,12 @@ } } - GCTraceTime tm("StringTable", false, false, &_gc_timer); - // Unlink any dead interned Strings and process the remaining live ones. - PSScavengeRootsClosure root_closure(promotion_manager); - StringTable::unlink_or_oops_do(&_is_alive_closure, &root_closure); + { + GCTraceTime tm("StringTable", false, false, &_gc_timer); + // Unlink any dead interned Strings and process the remaining live ones. + PSScavengeRootsClosure root_closure(promotion_manager); + StringTable::unlink_or_oops_do(&_is_alive_closure, &root_closure); + } // Finally, flush the promotion_manager's labs, and deallocate its stacks. promotion_failure_occurred = PSPromotionManager::post_scavenge(_gc_tracer); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/gc_interface/collectedHeap.hpp --- a/src/share/vm/gc_interface/collectedHeap.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/gc_interface/collectedHeap.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -389,15 +389,6 @@ // allocation from them and necessitating allocation of new TLABs. virtual void ensure_parsability(bool retire_tlabs); - // Return an estimate of the maximum allocation that could be performed - // without triggering any collection or expansion activity. In a - // generational collector, for example, this is probably the largest - // allocation that could be supported (without expansion) in the youngest - // generation. It is "unsafe" because no locks are taken; the result - // should be treated as an approximation, not a guarantee, for use in - // heuristic resizing decisions. - virtual size_t unsafe_max_alloc() = 0; - // Section on thread-local allocation buffers (TLABs) // If the heap supports thread-local allocation buffers, it should override // the following methods: diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/memory/allocation.cpp --- a/src/share/vm/memory/allocation.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/memory/allocation.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -71,9 +71,8 @@ return MetaspaceShared::is_in_shared_space(this); } - bool MetaspaceObj::is_metaspace_object() const { - return Metaspace::contains((void*)this); + return ClassLoaderDataGraph::contains((void*)this); } void MetaspaceObj::print_address_on(outputStream* st) const { diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/memory/allocation.hpp --- a/src/share/vm/memory/allocation.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/memory/allocation.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -264,7 +264,7 @@ class MetaspaceObj { public: - bool is_metaspace_object() const; // more specific test but slower + bool is_metaspace_object() const; bool is_shared() const; void print_address_on(outputStream* st) const; // nonvirtual address printing diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/memory/defNewGeneration.cpp --- a/src/share/vm/memory/defNewGeneration.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/memory/defNewGeneration.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -667,9 +667,6 @@ // for full GC's. AdaptiveSizePolicy* size_policy = gch->gen_policy()->size_policy(); size_policy->reset_gc_overhead_limit_count(); - if (PrintGC && !PrintGCDetails) { - gch->print_heap_change(gch_prev_used); - } assert(!gch->incremental_collection_failed(), "Should be clear"); } else { assert(_promo_failure_scan_stack.is_empty(), "post condition"); @@ -695,6 +692,9 @@ // Reset the PromotionFailureALot counters. NOT_PRODUCT(Universe::heap()->reset_promotion_should_fail();) } + if (PrintGC && !PrintGCDetails) { + gch->print_heap_change(gch_prev_used); + } // set new iteration safe limit for the survivor spaces from()->set_concurrent_iteration_safe_limit(from()->top()); to()->set_concurrent_iteration_safe_limit(to()->top()); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/memory/genCollectedHeap.cpp --- a/src/share/vm/memory/genCollectedHeap.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/memory/genCollectedHeap.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -673,10 +673,6 @@ return _gens[0]->end_addr(); } -size_t GenCollectedHeap::unsafe_max_alloc() { - return _gens[0]->unsafe_max_alloc_nogc(); -} - // public collection interfaces void GenCollectedHeap::collect(GCCause::Cause cause) { diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/memory/genCollectedHeap.hpp --- a/src/share/vm/memory/genCollectedHeap.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/memory/genCollectedHeap.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -166,14 +166,6 @@ HeapWord** top_addr() const; HeapWord** end_addr() const; - // Return an estimate of the maximum allocation that could be performed - // without triggering any collection activity. In a generational - // collector, for example, this is probably the largest allocation that - // could be supported in the youngest generation. It is "unsafe" because - // no locks are taken; the result should be treated as an approximation, - // not a guarantee. - size_t unsafe_max_alloc(); - // Does this heap support heap inspection? (+PrintClassHistogram) virtual bool supports_heap_inspection() const { return true; } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/memory/metachunk.hpp --- a/src/share/vm/memory/metachunk.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/memory/metachunk.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -143,6 +143,8 @@ void set_is_tagged_free(bool v) { _is_tagged_free = v; } #endif + bool contains(const void* ptr) { return bottom() <= ptr && ptr < _top; } + NOT_PRODUCT(void mangle();) void print_on(outputStream* st) const; diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/memory/metaspace.cpp --- a/src/share/vm/memory/metaspace.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/memory/metaspace.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -513,8 +513,6 @@ // Unlink empty VirtualSpaceNodes and free it. void purge(ChunkManager* chunk_manager); - bool contains(const void *ptr); - void print_on(outputStream* st) const; class VirtualSpaceListIterator : public StackObj { @@ -558,7 +556,7 @@ private: - // protects allocations and contains. + // protects allocations Mutex* const _lock; // Type of metadata allocated. @@ -595,7 +593,11 @@ private: // Accessors Metachunk* chunks_in_use(ChunkIndex index) const { return _chunks_in_use[index]; } - void set_chunks_in_use(ChunkIndex index, Metachunk* v) { _chunks_in_use[index] = v; } + void set_chunks_in_use(ChunkIndex index, Metachunk* v) { + // ensure lock-free iteration sees fully initialized node + OrderAccess::storestore(); + _chunks_in_use[index] = v; + } BlockFreelist* block_freelists() const { return (BlockFreelist*) &_block_freelists; @@ -708,6 +710,8 @@ void print_on(outputStream* st) const; void locked_print_chunks_in_use_on(outputStream* st) const; + bool contains(const void *ptr); + void verify(); void verify_chunk_size(Metachunk* chunk); NOT_PRODUCT(void mangle_freed_chunks();) @@ -1159,8 +1163,6 @@ } else { assert(new_entry->reserved_words() == vs_word_size, "Reserved memory size differs from requested memory size"); - // ensure lock-free iteration sees fully initialized node - OrderAccess::storestore(); link_vs(new_entry); return true; } @@ -1287,19 +1289,6 @@ } } -bool VirtualSpaceList::contains(const void *ptr) { - VirtualSpaceNode* list = virtual_space_list(); - VirtualSpaceListIterator iter(list); - while (iter.repeat()) { - VirtualSpaceNode* node = iter.get_next(); - if (node->reserved()->contains(ptr)) { - return true; - } - } - return false; -} - - // MetaspaceGC methods // VM_CollectForMetadataAllocation is the vm operation used to GC. @@ -1466,9 +1455,10 @@ // No expansion, now see if we want to shrink // We would never want to shrink more than this + assert(capacity_until_GC >= minimum_desired_capacity, + err_msg(SIZE_FORMAT " >= " SIZE_FORMAT, + capacity_until_GC, minimum_desired_capacity)); size_t max_shrink_bytes = capacity_until_GC - minimum_desired_capacity; - assert(max_shrink_bytes >= 0, err_msg("max_shrink_bytes " SIZE_FORMAT, - max_shrink_bytes)); // Should shrinking be considered? if (MaxMetaspaceFreeRatio < 100) { @@ -2392,6 +2382,21 @@ return result; } +// This function looks at the chunks in the metaspace without locking. +// The chunks are added with store ordering and not deleted except for at +// unloading time. +bool SpaceManager::contains(const void *ptr) { + for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) + { + Metachunk* curr = chunks_in_use(i); + while (curr != NULL) { + if (curr->contains(ptr)) return true; + curr = curr->next(); + } + } + return false; +} + void SpaceManager::verify() { // If there are blocks in the dictionary, then // verfication of chunks does not work since @@ -3463,17 +3468,12 @@ } } -bool Metaspace::contains(const void * ptr) { - if (MetaspaceShared::is_in_shared_space(ptr)) { - return true; +bool Metaspace::contains(const void* ptr) { + if (vsm()->contains(ptr)) return true; + if (using_class_space()) { + return class_vsm()->contains(ptr); } - // This is checked while unlocked. As long as the virtualspaces are added - // at the end, the pointer will be in one of them. The virtual spaces - // aren't deleted presently. When they are, some sort of locking might - // be needed. Note, locking this can cause inversion problems with the - // caller in MetaspaceObj::is_metadata() function. - return space_list()->contains(ptr) || - (using_class_space() && class_space_list()->contains(ptr)); + return false; } void Metaspace::verify() { diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/memory/metaspace.hpp --- a/src/share/vm/memory/metaspace.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/memory/metaspace.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -225,7 +225,7 @@ MetaWord* expand_and_allocate(size_t size, MetadataType mdtype); - static bool contains(const void *ptr); + bool contains(const void* ptr); void dump(outputStream* const out) const; // Free empty virtualspaces diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/memory/referenceProcessor.cpp --- a/src/share/vm/memory/referenceProcessor.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/memory/referenceProcessor.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -100,7 +100,6 @@ _enqueuing_is_done(false), _is_alive_non_header(is_alive_non_header), _discovered_list_needs_barrier(discovered_list_needs_barrier), - _bs(NULL), _processing_is_mt(mt_processing), _next_id(0) { @@ -126,10 +125,6 @@ _discovered_refs[i].set_length(0); } - // If we do barriers, cache a copy of the barrier set. - if (discovered_list_needs_barrier) { - _bs = Universe::heap()->barrier_set(); - } setup_policy(false /* default soft ref policy */); } @@ -317,13 +312,9 @@ // Enqueue references that are not made active again, and // clear the decks for the next collection (cycle). ref->enqueue_discovered_reflists((HeapWord*)pending_list_addr, task_executor); - // Do the oop-check on pending_list_addr missed in - // enqueue_discovered_reflist. We should probably - // do a raw oop_check so that future such idempotent - // oop_stores relying on the oop-check side-effect - // may be elided automatically and safely without - // affecting correctness. - oop_store(pending_list_addr, oopDesc::load_decode_heap_oop(pending_list_addr)); + // Do the post-barrier on pending_list_addr missed in + // enqueue_discovered_reflist. + oopDesc::bs()->write_ref_field(pending_list_addr, oopDesc::load_decode_heap_oop(pending_list_addr)); // Stop treating discovered references specially. ref->disable_discovery(); @@ -372,15 +363,17 @@ assert(java_lang_ref_Reference::next(obj) == NULL, "Reference not active; should not be discovered"); // Self-loop next, so as to make Ref not active. - java_lang_ref_Reference::set_next(obj, obj); + // Post-barrier not needed when looping to self. + java_lang_ref_Reference::set_next_raw(obj, obj); if (next_d == obj) { // obj is last // Swap refs_list into pendling_list_addr and // set obj's discovered to what we read from pending_list_addr. oop old = oopDesc::atomic_exchange_oop(refs_list.head(), pending_list_addr); - // Need oop_check on pending_list_addr above; - // see special oop-check code at the end of + // Need post-barrier on pending_list_addr above; + // see special post-barrier code at the end of // enqueue_discovered_reflists() further below. - java_lang_ref_Reference::set_discovered(obj, old); // old may be NULL + java_lang_ref_Reference::set_discovered_raw(obj, old); // old may be NULL + oopDesc::bs()->write_ref_field(java_lang_ref_Reference::discovered_addr(obj), old); } } } else { // Old behaviour @@ -516,13 +509,11 @@ // the reference object and will fail // CT verification. if (UseG1GC) { - BarrierSet* bs = oopDesc::bs(); HeapWord* next_addr = java_lang_ref_Reference::next_addr(_ref); - if (UseCompressedOops) { - bs->write_ref_field_pre((narrowOop*)next_addr, NULL); + oopDesc::bs()->write_ref_field_pre((narrowOop*)next_addr, NULL); } else { - bs->write_ref_field_pre((oop*)next_addr, NULL); + oopDesc::bs()->write_ref_field_pre((oop*)next_addr, NULL); } java_lang_ref_Reference::set_next_raw(_ref, NULL); } else { @@ -790,10 +781,9 @@ }; void ReferenceProcessor::set_discovered(oop ref, oop value) { + java_lang_ref_Reference::set_discovered_raw(ref, value); if (_discovered_list_needs_barrier) { - java_lang_ref_Reference::set_discovered(ref, value); - } else { - java_lang_ref_Reference::set_discovered_raw(ref, value); + oopDesc::bs()->write_ref_field(ref, value); } } @@ -1085,7 +1075,7 @@ // so this will expand to nothing. As a result, we have manually // elided this out for G1, but left in the test for some future // collector that might have need for a pre-barrier here, e.g.:- - // _bs->write_ref_field_pre((oop* or narrowOop*)discovered_addr, next_discovered); + // oopDesc::bs()->write_ref_field_pre((oop* or narrowOop*)discovered_addr, next_discovered); assert(!_discovered_list_needs_barrier || UseG1GC, "Need to check non-G1 collector: " "may need a pre-write-barrier for CAS from NULL below"); @@ -1098,7 +1088,7 @@ refs_list.set_head(obj); refs_list.inc_length(1); if (_discovered_list_needs_barrier) { - _bs->write_ref_field((void*)discovered_addr, next_discovered); + oopDesc::bs()->write_ref_field((void*)discovered_addr, next_discovered); } if (TraceReferenceGC) { @@ -1260,13 +1250,13 @@ // As in the case further above, since we are over-writing a NULL // pre-value, we can safely elide the pre-barrier here for the case of G1. - // e.g.:- _bs->write_ref_field_pre((oop* or narrowOop*)discovered_addr, next_discovered); + // e.g.:- oopDesc::bs()->write_ref_field_pre((oop* or narrowOop*)discovered_addr, next_discovered); assert(discovered == NULL, "control point invariant"); assert(!_discovered_list_needs_barrier || UseG1GC, "For non-G1 collector, may need a pre-write-barrier for CAS from NULL below"); oop_store_raw(discovered_addr, next_discovered); if (_discovered_list_needs_barrier) { - _bs->write_ref_field((void*)discovered_addr, next_discovered); + oopDesc::bs()->write_ref_field((void*)discovered_addr, next_discovered); } list->set_head(obj); list->inc_length(1); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/memory/referenceProcessor.hpp --- a/src/share/vm/memory/referenceProcessor.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/memory/referenceProcessor.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -235,7 +235,6 @@ // discovery.) bool _discovered_list_needs_barrier; - BarrierSet* _bs; // Cached copy of BarrierSet. bool _enqueuing_is_done; // true if all weak references enqueued bool _processing_is_mt; // true during phases when // reference processing is MT. @@ -420,25 +419,6 @@ void update_soft_ref_master_clock(); public: - // constructor - ReferenceProcessor(): - _span((HeapWord*)NULL, (HeapWord*)NULL), - _discovered_refs(NULL), - _discoveredSoftRefs(NULL), _discoveredWeakRefs(NULL), - _discoveredFinalRefs(NULL), _discoveredPhantomRefs(NULL), - _discovering_refs(false), - _discovery_is_atomic(true), - _enqueuing_is_done(false), - _discovery_is_mt(false), - _discovered_list_needs_barrier(false), - _bs(NULL), - _is_alive_non_header(NULL), - _num_q(0), - _max_num_q(0), - _processing_is_mt(false), - _next_id(0) - { } - // Default parameters give you a vanilla reference processor. ReferenceProcessor(MemRegion span, bool mt_processing = false, uint mt_processing_degree = 1, diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/oops/klass.cpp --- a/src/share/vm/oops/klass.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/oops/klass.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -376,8 +376,6 @@ } bool Klass::is_loader_alive(BoolObjectClosure* is_alive) { - assert(ClassLoaderDataGraph::contains((address)this), "is in the metaspace"); - #ifdef ASSERT // The class is alive iff the class loader is alive. oop loader = class_loader(); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/bytecodeInfo.cpp --- a/src/share/vm/opto/bytecodeInfo.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/bytecodeInfo.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -63,34 +63,14 @@ assert(_caller_jvms->same_calls_as(caller_jvms), "consistent JVMS"); assert((caller_tree == NULL ? 0 : caller_tree->stack_depth() + 1) == stack_depth(), "correct (redundant) depth parameter"); assert(caller_bci == this->caller_bci(), "correct (redundant) bci parameter"); - if (UseOldInlining) { - // Update hierarchical counts, count_inline_bcs() and count_inlines() - InlineTree *caller = (InlineTree *)caller_tree; - for( ; caller != NULL; caller = ((InlineTree *)(caller->caller_tree())) ) { - caller->_count_inline_bcs += count_inline_bcs(); - NOT_PRODUCT(caller->_count_inlines++;) - } + // Update hierarchical counts, count_inline_bcs() and count_inlines() + InlineTree *caller = (InlineTree *)caller_tree; + for( ; caller != NULL; caller = ((InlineTree *)(caller->caller_tree())) ) { + caller->_count_inline_bcs += count_inline_bcs(); + NOT_PRODUCT(caller->_count_inlines++;) } } -InlineTree::InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvms, - float site_invoke_ratio, int max_inline_level) : - C(c), - _caller_jvms(caller_jvms), - _caller_tree(NULL), - _method(callee_method), - _site_invoke_ratio(site_invoke_ratio), - _max_inline_level(max_inline_level), - _count_inline_bcs(method()->code_size()), - _msg(NULL) -{ -#ifndef PRODUCT - _count_inlines = 0; - _forced_inline = false; -#endif - assert(!UseOldInlining, "do not use for old stuff"); -} - /** * Return true when EA is ON and a java constructor is called or * a super constructor is called from an inlined java constructor. @@ -161,11 +141,6 @@ return true; } - if (!UseOldInlining) { - set_msg("!UseOldInlining"); - return true; // size and frequency are represented in a new way - } - int default_max_inline_size = C->max_inline_size(); int inline_small_code_size = InlineSmallCode / 4; int max_inline_size = default_max_inline_size; @@ -229,35 +204,6 @@ fail_msg = "don't inline by annotation"; } - if (!UseOldInlining) { - if (fail_msg != NULL) { - *wci_result = *(WarmCallInfo::always_cold()); - set_msg(fail_msg); - return true; - } - - if (callee_method->has_unloaded_classes_in_signature()) { - wci_result->set_profit(wci_result->profit() * 0.1); - } - - // don't inline exception code unless the top method belongs to an - // exception class - if (callee_method->holder()->is_subclass_of(C->env()->Throwable_klass())) { - ciMethod* top_method = jvms->caller() != NULL ? jvms->caller()->of_depth(1)->method() : method(); - if (!top_method->holder()->is_subclass_of(C->env()->Throwable_klass())) { - wci_result->set_profit(wci_result->profit() * 0.1); - } - } - - if (callee_method->has_compiled_code() && - callee_method->instructions_size() > InlineSmallCode) { - wci_result->set_profit(wci_result->profit() * 0.1); - // %%% adjust wci_result->size()? - } - - return false; - } - // one more inlining restriction if (fail_msg == NULL && callee_method->has_unloaded_classes_in_signature()) { fail_msg = "unloaded signature classes"; @@ -360,9 +306,7 @@ int caller_bci, JVMState* jvms, ciCallProfile& profile, WarmCallInfo* wci_result, bool& should_delay) { - // Old algorithm had funny accumulating BC-size counters - if (UseOldInlining && ClipInlining - && (int)count_inline_bcs() >= DesiredMethodLimit) { + if (ClipInlining && (int)count_inline_bcs() >= DesiredMethodLimit) { if (!callee_method->force_inline() || !IncrementalInline) { set_msg("size > DesiredMethodLimit"); return false; @@ -465,8 +409,7 @@ int size = callee_method->code_size_for_inlining(); - if (UseOldInlining && ClipInlining - && (int)count_inline_bcs() + size >= DesiredMethodLimit) { + if (ClipInlining && (int)count_inline_bcs() + size >= DesiredMethodLimit) { if (!callee_method->force_inline() || !IncrementalInline) { set_msg("size > DesiredMethodLimit"); return false; @@ -584,8 +527,7 @@ jvms, profile, &wci, should_delay); #ifndef PRODUCT - if (UseOldInlining && InlineWarmCalls - && (PrintOpto || C->print_inlining())) { + if (InlineWarmCalls && (PrintOpto || C->print_inlining())) { bool cold = wci.is_cold(); bool hot = !cold && wci.is_hot(); bool old_cold = !success; @@ -599,13 +541,12 @@ } } #endif - if (UseOldInlining) { - if (success) { - wci = *(WarmCallInfo::always_hot()); - } else { - wci = *(WarmCallInfo::always_cold()); - } + if (success) { + wci = *(WarmCallInfo::always_hot()); + } else { + wci = *(WarmCallInfo::always_cold()); } + if (!InlineWarmCalls) { if (!wci.is_cold() && !wci.is_hot()) { // Do not inline the warm calls. @@ -619,8 +560,7 @@ set_msg("inline (hot)"); } print_inlining(callee_method, caller_bci, true /* success */); - if (UseOldInlining) - build_inline_tree_for_callee(callee_method, jvms, caller_bci); + build_inline_tree_for_callee(callee_method, jvms, caller_bci); if (InlineWarmCalls && !wci.is_hot()) return new (C) WarmCallInfo(wci); // copy to heap return WarmCallInfo::always_hot(); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/c2_globals.hpp --- a/src/share/vm/opto/c2_globals.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/c2_globals.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -350,9 +350,6 @@ "File to dump ideal graph to. If set overrides the " \ "use of the network") \ \ - product(bool, UseOldInlining, true, \ - "Enable the 1.3 inlining strategy") \ - \ product(bool, UseBimorphicInlining, true, \ "Profiling based inlining for two receivers") \ \ diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/callGenerator.cpp --- a/src/share/vm/opto/callGenerator.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/callGenerator.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -722,7 +722,7 @@ Node* m = kit.map()->in(i); Node* n = slow_map->in(i); if (m != n) { - const Type* t = gvn.type(m)->meet(gvn.type(n)); + const Type* t = gvn.type(m)->meet_speculative(gvn.type(n)); Node* phi = PhiNode::make(region, m, t); phi->set_req(2, n); kit.map()->set_req(i, gvn.transform(phi)); @@ -975,7 +975,7 @@ Node* m = kit.map()->in(i); Node* n = slow_map->in(i); if (m != n) { - const Type* t = gvn.type(m)->meet(gvn.type(n)); + const Type* t = gvn.type(m)->meet_speculative(gvn.type(n)); Node* phi = PhiNode::make(region, m, t); phi->set_req(2, n); kit.map()->set_req(i, gvn.transform(phi)); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/cfgnode.cpp --- a/src/share/vm/opto/cfgnode.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/cfgnode.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -951,7 +951,7 @@ if (is_intf != ti_is_intf) { t = _type; break; } } - t = t->meet(ti); + t = t->meet_speculative(ti); } } @@ -968,11 +968,11 @@ // // It is not possible to see Type::BOTTOM values as phi inputs, // because the ciTypeFlow pre-pass produces verifier-quality types. - const Type* ft = t->filter(_type); // Worst case type + const Type* ft = t->filter_speculative(_type); // Worst case type #ifdef ASSERT // The following logic has been moved into TypeOopPtr::filter. - const Type* jt = t->join(_type); + const Type* jt = t->join_speculative(_type); if( jt->empty() ) { // Emptied out??? // Check for evil case of 't' being a class and '_type' expecting an @@ -1757,7 +1757,7 @@ break; } // Accumulate type for resulting Phi - type = type->meet(in(i)->in(AddPNode::Base)->bottom_type()); + type = type->meet_speculative(in(i)->in(AddPNode::Base)->bottom_type()); } Node* base = NULL; if (doit) { diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/compile.cpp --- a/src/share/vm/opto/compile.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/compile.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -701,10 +701,7 @@ print_compile_messages(); - if (UseOldInlining || PrintCompilation NOT_PRODUCT( || PrintOpto) ) - _ilt = InlineTree::build_inline_tree_root(); - else - _ilt = NULL; + _ilt = InlineTree::build_inline_tree_root(); // Even if NO memory addresses are used, MergeMem nodes must have at least 1 slice assert(num_alias_types() >= AliasIdxRaw, ""); @@ -3919,16 +3916,18 @@ // which may optimize it out. for (uint next = 0; next < worklist.size(); ++next) { Node *n = worklist.at(next); - if (n->is_Type() && n->as_Type()->type()->isa_oopptr() != NULL && - n->as_Type()->type()->is_oopptr()->speculative() != NULL) { + if (n->is_Type()) { TypeNode* tn = n->as_Type(); - const TypeOopPtr* t = tn->type()->is_oopptr(); - bool in_hash = igvn.hash_delete(n); - assert(in_hash, "node should be in igvn hash table"); - tn->set_type(t->remove_speculative()); - igvn.hash_insert(n); - igvn._worklist.push(n); // give it a chance to go away - modified++; + const Type* t = tn->type(); + const Type* t_no_spec = t->remove_speculative(); + if (t_no_spec != t) { + bool in_hash = igvn.hash_delete(n); + assert(in_hash, "node should be in igvn hash table"); + tn->set_type(t_no_spec); + igvn.hash_insert(n); + igvn._worklist.push(n); // give it a chance to go away + modified++; + } } uint max = n->len(); for( uint i = 0; i < max; ++i ) { @@ -3942,6 +3941,27 @@ if (modified > 0) { igvn.optimize(); } +#ifdef ASSERT + // Verify that after the IGVN is over no speculative type has resurfaced + worklist.clear(); + worklist.push(root()); + for (uint next = 0; next < worklist.size(); ++next) { + Node *n = worklist.at(next); + const Type* t = igvn.type(n); + assert(t == t->remove_speculative(), "no more speculative types"); + if (n->is_Type()) { + t = n->as_Type()->type(); + assert(t == t->remove_speculative(), "no more speculative types"); + } + uint max = n->len(); + for( uint i = 0; i < max; ++i ) { + Node *m = n->in(i); + if (not_a_node(m)) continue; + worklist.push(m); + } + } + igvn.check_no_speculative_types(); +#endif } } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/connode.cpp --- a/src/share/vm/opto/connode.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/connode.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -188,7 +188,7 @@ const Type *CMoveNode::Value( PhaseTransform *phase ) const { if( phase->type(in(Condition)) == Type::TOP ) return Type::TOP; - return phase->type(in(IfFalse))->meet(phase->type(in(IfTrue))); + return phase->type(in(IfFalse))->meet_speculative(phase->type(in(IfTrue))); } //------------------------------make------------------------------------------- @@ -392,14 +392,14 @@ //============================================================================= // If input is already higher or equal to cast type, then this is an identity. Node *ConstraintCastNode::Identity( PhaseTransform *phase ) { - return phase->type(in(1))->higher_equal(_type) ? in(1) : this; + return phase->type(in(1))->higher_equal_speculative(_type) ? in(1) : this; } //------------------------------Value------------------------------------------ // Take 'join' of input and cast-up type const Type *ConstraintCastNode::Value( PhaseTransform *phase ) const { if( in(0) && phase->type(in(0)) == Type::TOP ) return Type::TOP; - const Type* ft = phase->type(in(1))->filter(_type); +const Type* ft = phase->type(in(1))->filter_speculative(_type); #ifdef ASSERT // Previous versions of this function had some special case logic, @@ -409,7 +409,7 @@ { const Type* t1 = phase->type(in(1)); if( t1 == Type::TOP ) assert(ft == Type::TOP, "special case #1"); - const Type* rt = t1->join(_type); + const Type* rt = t1->join_speculative(_type); if (rt->empty()) assert(ft == Type::TOP, "special case #2"); break; } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/connode.hpp --- a/src/share/vm/opto/connode.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/connode.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -36,7 +36,7 @@ // Simple constants class ConNode : public TypeNode { public: - ConNode( const Type *t ) : TypeNode(t,1) { + ConNode( const Type *t ) : TypeNode(t->remove_speculative(),1) { init_req(0, (Node*)Compile::current()->root()); init_flags(Flag_is_Con); } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/doCall.cpp --- a/src/share/vm/opto/doCall.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/doCall.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -161,19 +161,8 @@ // Try inlining a bytecoded method: if (!call_does_dispatch) { - InlineTree* ilt; - if (UseOldInlining) { - ilt = InlineTree::find_subtree_from_root(this->ilt(), jvms->caller(), jvms->method()); - } else { - // Make a disembodied, stateless ILT. - // TO DO: When UseOldInlining is removed, copy the ILT code elsewhere. - float site_invoke_ratio = prof_factor; - // Note: ilt is for the root of this parse, not the present call site. - ilt = new InlineTree(this, jvms->method(), jvms->caller(), site_invoke_ratio, MaxInlineLevel); - } + InlineTree* ilt = InlineTree::find_subtree_from_root(this->ilt(), jvms->caller(), jvms->method()); WarmCallInfo scratch_ci; - if (!UseOldInlining) - scratch_ci.init(jvms, callee, profile, prof_factor); bool should_delay = false; WarmCallInfo* ci = ilt->ok_to_inline(callee, jvms, profile, &scratch_ci, should_delay); assert(ci != &scratch_ci, "do not let this pointer escape"); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/graphKit.cpp --- a/src/share/vm/opto/graphKit.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/graphKit.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -420,7 +420,7 @@ } const Type* srctype = _gvn.type(src); if (phi->type() != srctype) { - const Type* dsttype = phi->type()->meet(srctype); + const Type* dsttype = phi->type()->meet_speculative(srctype); if (phi->type() != dsttype) { phi->set_type(dsttype); _gvn.set_type(phi, dsttype); @@ -1223,7 +1223,7 @@ // See if mixing in the NULL pointer changes type. // If so, then the NULL pointer was not allowed in the original // type. In other words, "value" was not-null. - if (t->meet(TypePtr::NULL_PTR) != t) { + if (t->meet(TypePtr::NULL_PTR) != t->remove_speculative()) { // same as: if (!TypePtr::NULL_PTR->higher_equal(t)) ... explicit_null_checks_elided++; return value; // Elided null check quickly! @@ -1356,7 +1356,7 @@ // Cast obj to not-null on this path Node* GraphKit::cast_not_null(Node* obj, bool do_replace_in_map) { const Type *t = _gvn.type(obj); - const Type *t_not_null = t->join(TypePtr::NOTNULL); + const Type *t_not_null = t->join_speculative(TypePtr::NOTNULL); // Object is already not-null? if( t == t_not_null ) return obj; @@ -3009,7 +3009,7 @@ if (failure_control != NULL) // failure is now impossible (*failure_control) = top(); // adjust the type of the phi to the exact klass: - phi->raise_bottom_type(_gvn.type(cast_obj)->meet(TypePtr::NULL_PTR)); + phi->raise_bottom_type(_gvn.type(cast_obj)->meet_speculative(TypePtr::NULL_PTR)); } } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/loopopts.cpp --- a/src/share/vm/opto/loopopts.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/loopopts.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -1115,8 +1115,8 @@ Node *n2 = phi->in(i)->in(1)->in(2); phi1->set_req( i, n1 ); phi2->set_req( i, n2 ); - phi1->set_type( phi1->type()->meet(n1->bottom_type()) ); - phi2->set_type( phi2->type()->meet(n2->bottom_type()) ); + phi1->set_type( phi1->type()->meet_speculative(n1->bottom_type())); + phi2->set_type( phi2->type()->meet_speculative(n2->bottom_type())); } // See if these Phis have been made before. // Register with optimizer @@ -1189,8 +1189,8 @@ } phi1->set_req( j, n1 ); phi2->set_req( j, n2 ); - phi1->set_type( phi1->type()->meet(n1->bottom_type()) ); - phi2->set_type( phi2->type()->meet(n2->bottom_type()) ); + phi1->set_type(phi1->type()->meet_speculative(n1->bottom_type())); + phi2->set_type(phi2->type()->meet_speculative(n2->bottom_type())); } // See if these Phis have been made before. diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/memnode.cpp --- a/src/share/vm/opto/memnode.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/memnode.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -657,7 +657,7 @@ // disregarding "null"-ness. // (We make an exception for TypeRawPtr::BOTTOM, which is a bit bucket.) const TypePtr* tp_notnull = tp->join(TypePtr::NOTNULL)->is_ptr(); - assert(cross_check->meet(tp_notnull) == cross_check, + assert(cross_check->meet(tp_notnull) == cross_check->remove_speculative(), "real address must not escape from expected memory type"); } #endif @@ -1681,7 +1681,7 @@ // t might actually be lower than _type, if _type is a unique // concrete subclass of abstract class t. if (off_beyond_header) { // is the offset beyond the header? - const Type* jt = t->join(_type); + const Type* jt = t->join_speculative(_type); // In any case, do not allow the join, per se, to empty out the type. if (jt->empty() && !t->empty()) { // This can happen if a interface-typed array narrows to a class type. diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/multnode.cpp --- a/src/share/vm/opto/multnode.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/multnode.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -94,7 +94,7 @@ if ((_con == TypeFunc::Parms) && n->is_CallStaticJava() && n->as_CallStaticJava()->is_boxing_method()) { // The result of autoboxing is always non-null on normal path. - t = t->join(TypePtr::NOTNULL); + t = t->join_speculative(TypePtr::NOTNULL); } return t; } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/node.cpp --- a/src/share/vm/opto/node.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/node.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -995,13 +995,13 @@ if (is_Type()) { TypeNode *n = this->as_Type(); if (VerifyAliases) { - assert(new_type->higher_equal(n->type()), "new type must refine old type"); + assert(new_type->higher_equal_speculative(n->type()), "new type must refine old type"); } n->set_type(new_type); } else if (is_Load()) { LoadNode *n = this->as_Load(); if (VerifyAliases) { - assert(new_type->higher_equal(n->type()), "new type must refine old type"); + assert(new_type->higher_equal_speculative(n->type()), "new type must refine old type"); } n->set_type(new_type); } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/parse1.cpp --- a/src/share/vm/opto/parse1.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/parse1.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -1649,7 +1649,7 @@ assert(bt1 != Type::BOTTOM, "should not be building conflict phis"); map()->set_req(j, _gvn.transform_no_reclaim(phi)); debug_only(const Type* bt2 = phi->bottom_type()); - assert(bt2->higher_equal(bt1), "must be consistent with type-flow"); + assert(bt2->higher_equal_speculative(bt1), "must be consistent with type-flow"); record_for_igvn(phi); } } @@ -2022,7 +2022,7 @@ !tp->klass()->is_interface()) { // sharpen the type eagerly; this eases certain assert checking if (tp->higher_equal(TypeInstPtr::NOTNULL)) - tr = tr->join(TypeInstPtr::NOTNULL)->is_instptr(); + tr = tr->join_speculative(TypeInstPtr::NOTNULL)->is_instptr(); value = _gvn.transform(new (C) CheckCastPPNode(0,value,tr)); } } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/parse2.cpp --- a/src/share/vm/opto/parse2.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/parse2.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -88,7 +88,7 @@ if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) { // If we load from "AbstractClass[]" we must see "ConcreteSubClass". const Type* subklass = Type::get_const_type(toop->klass()); - elemtype = subklass->join(el); + elemtype = subklass->join_speculative(el); } } } @@ -1278,7 +1278,7 @@ // Bool(CmpP(LoadKlass(obj._klass), ConP(Foo.klass)), [eq]) // or the narrowOop equivalent. const Type* obj_type = _gvn.type(obj); - const TypeOopPtr* tboth = obj_type->join(con_type)->isa_oopptr(); + const TypeOopPtr* tboth = obj_type->join_speculative(con_type)->isa_oopptr(); if (tboth != NULL && tboth->klass_is_exact() && tboth != obj_type && tboth->higher_equal(obj_type)) { // obj has to be of the exact type Foo if the CmpP succeeds. @@ -1288,7 +1288,7 @@ (jvms->is_loc(obj_in_map) || jvms->is_stk(obj_in_map))) { TypeNode* ccast = new (C) CheckCastPPNode(control(), obj, tboth); const Type* tcc = ccast->as_Type()->type(); - assert(tcc != obj_type && tcc->higher_equal(obj_type), "must improve"); + assert(tcc != obj_type && tcc->higher_equal_speculative(obj_type), "must improve"); // Delay transform() call to allow recovery of pre-cast value // at the control merge. _gvn.set_type_bottom(ccast); @@ -1318,7 +1318,7 @@ switch (btest) { case BoolTest::eq: // Constant test? { - const Type* tboth = tcon->join(tval); + const Type* tboth = tcon->join_speculative(tval); if (tboth == tval) break; // Nothing to gain. if (tcon->isa_int()) { ccast = new (C) CastIINode(val, tboth); @@ -1352,7 +1352,7 @@ if (ccast != NULL) { const Type* tcc = ccast->as_Type()->type(); - assert(tcc != tval && tcc->higher_equal(tval), "must improve"); + assert(tcc != tval && tcc->higher_equal_speculative(tval), "must improve"); // Delay transform() call to allow recovery of pre-cast value // at the control merge. ccast->set_req(0, control()); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/parse3.cpp --- a/src/share/vm/opto/parse3.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/parse3.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -337,7 +337,7 @@ // should_be_constant = (oop not scavengable || ScavengeRootsInCode >= 2) // An oop is not scavengable if it is in the perm gen. if (stable_type != NULL && con_type != NULL && con_type->isa_oopptr()) - con_type = con_type->join(stable_type); + con_type = con_type->join_speculative(stable_type); break; case T_ILLEGAL: diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/phaseX.cpp --- a/src/share/vm/opto/phaseX.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/phaseX.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -323,6 +323,23 @@ } } + +void NodeHash::check_no_speculative_types() { +#ifdef ASSERT + uint max = size(); + Node *sentinel_node = sentinel(); + for (uint i = 0; i < max; ++i) { + Node *n = at(i); + if(n != NULL && n != sentinel_node && n->is_Type()) { + TypeNode* tn = n->as_Type(); + const Type* t = tn->type(); + const Type* t_no_spec = t->remove_speculative(); + assert(t == t_no_spec, "dead node in hash table or missed node during speculative cleanup"); + } + } +#endif +} + #ifndef PRODUCT //------------------------------dump------------------------------------------- // Dump statistics for the hash table @@ -1392,11 +1409,11 @@ assert(UseTypeSpeculation, "speculation is off"); for (uint i = 0; i < _types.Size(); i++) { const Type* t = _types.fast_lookup(i); - if (t != NULL && t->isa_oopptr()) { - const TypeOopPtr* to = t->is_oopptr(); - _types.map(i, to->remove_speculative()); + if (t != NULL) { + _types.map(i, t->remove_speculative()); } } + _table.check_no_speculative_types(); } //============================================================================= diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/phaseX.hpp --- a/src/share/vm/opto/phaseX.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/phaseX.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -92,7 +92,8 @@ } void remove_useless_nodes(VectorSet &useful); // replace with sentinel - void replace_with(NodeHash* nh); + void replace_with(NodeHash* nh); + void check_no_speculative_types(); // Check no speculative part for type nodes in table Node *sentinel() { return _sentinel; } @@ -501,6 +502,9 @@ Deoptimization::DeoptReason reason); void remove_speculative_types(); + void check_no_speculative_types() { + _table.check_no_speculative_types(); + } #ifndef PRODUCT protected: diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/type.cpp --- a/src/share/vm/opto/type.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/type.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -236,6 +236,13 @@ return !t1->eq(t2); // Return ZERO if equal } +const Type* Type::maybe_remove_speculative(bool include_speculative) const { + if (!include_speculative) { + return remove_speculative(); + } + return this; +} + //------------------------------hash------------------------------------------- int Type::uhash( const Type *const t ) { return t->hash(); @@ -628,41 +635,44 @@ //------------------------------meet------------------------------------------- // Compute the MEET of two types. NOT virtual. It enforces that meet is // commutative and the lattice is symmetric. -const Type *Type::meet( const Type *t ) const { +const Type *Type::meet_helper(const Type *t, bool include_speculative) const { if (isa_narrowoop() && t->isa_narrowoop()) { - const Type* result = make_ptr()->meet(t->make_ptr()); + const Type* result = make_ptr()->meet_helper(t->make_ptr(), include_speculative); return result->make_narrowoop(); } if (isa_narrowklass() && t->isa_narrowklass()) { - const Type* result = make_ptr()->meet(t->make_ptr()); + const Type* result = make_ptr()->meet_helper(t->make_ptr(), include_speculative); return result->make_narrowklass(); } - const Type *mt = xmeet(t); + const Type *this_t = maybe_remove_speculative(include_speculative); + t = t->maybe_remove_speculative(include_speculative); + + const Type *mt = this_t->xmeet(t); if (isa_narrowoop() || t->isa_narrowoop()) return mt; if (isa_narrowklass() || t->isa_narrowklass()) return mt; #ifdef ASSERT - assert( mt == t->xmeet(this), "meet not commutative" ); + assert(mt == t->xmeet(this_t), "meet not commutative"); const Type* dual_join = mt->_dual; const Type *t2t = dual_join->xmeet(t->_dual); - const Type *t2this = dual_join->xmeet( _dual); + const Type *t2this = dual_join->xmeet(this_t->_dual); // Interface meet Oop is Not Symmetric: // Interface:AnyNull meet Oop:AnyNull == Interface:AnyNull // Interface:NotNull meet Oop:NotNull == java/lang/Object:NotNull - if( !interface_vs_oop(t) && (t2t != t->_dual || t2this != _dual) ) { + if( !interface_vs_oop(t) && (t2t != t->_dual || t2this != this_t->_dual) ) { tty->print_cr("=== Meet Not Symmetric ==="); - tty->print("t = "); t->dump(); tty->cr(); - tty->print("this= "); dump(); tty->cr(); - tty->print("mt=(t meet this)= "); mt->dump(); tty->cr(); - - tty->print("t_dual= "); t->_dual->dump(); tty->cr(); - tty->print("this_dual= "); _dual->dump(); tty->cr(); - tty->print("mt_dual= "); mt->_dual->dump(); tty->cr(); - - tty->print("mt_dual meet t_dual= "); t2t ->dump(); tty->cr(); - tty->print("mt_dual meet this_dual= "); t2this ->dump(); tty->cr(); + tty->print("t = "); t->dump(); tty->cr(); + tty->print("this= "); this_t->dump(); tty->cr(); + tty->print("mt=(t meet this)= "); mt->dump(); tty->cr(); + + tty->print("t_dual= "); t->_dual->dump(); tty->cr(); + tty->print("this_dual= "); this_t->_dual->dump(); tty->cr(); + tty->print("mt_dual= "); mt->_dual->dump(); tty->cr(); + + tty->print("mt_dual meet t_dual= "); t2t ->dump(); tty->cr(); + tty->print("mt_dual meet this_dual= "); t2this ->dump(); tty->cr(); fatal("meet not symmetric" ); } @@ -754,8 +764,8 @@ } //-----------------------------filter------------------------------------------ -const Type *Type::filter( const Type *kills ) const { - const Type* ft = join(kills); +const Type *Type::filter_helper(const Type *kills, bool include_speculative) const { + const Type* ft = join_helper(kills, include_speculative); if (ft->empty()) return Type::TOP; // Canonical empty value return ft; @@ -1309,8 +1319,8 @@ } //-----------------------------filter------------------------------------------ -const Type *TypeInt::filter( const Type *kills ) const { - const TypeInt* ft = join(kills)->isa_int(); +const Type *TypeInt::filter_helper(const Type *kills, bool include_speculative) const { + const TypeInt* ft = join_helper(kills, include_speculative)->isa_int(); if (ft == NULL || ft->empty()) return Type::TOP; // Canonical empty value if (ft->_widen < this->_widen) { @@ -1570,8 +1580,8 @@ } //-----------------------------filter------------------------------------------ -const Type *TypeLong::filter( const Type *kills ) const { - const TypeLong* ft = join(kills)->isa_long(); +const Type *TypeLong::filter_helper(const Type *kills, bool include_speculative) const { + const TypeLong* ft = join_helper(kills, include_speculative)->isa_long(); if (ft == NULL || ft->empty()) return Type::TOP; // Canonical empty value if (ft->_widen < this->_widen) { @@ -1726,7 +1736,7 @@ total_fields++; field_array = fields(total_fields); // Use get_const_type here because it respects UseUniqueSubclasses: - field_array[pos++] = get_const_type(recv)->join(TypePtr::NOTNULL); + field_array[pos++] = get_const_type(recv)->join_speculative(TypePtr::NOTNULL); } else { field_array = fields(total_fields); } @@ -1916,7 +1926,7 @@ case Array: { // Meeting 2 arrays? const TypeAry *a = t->is_ary(); - return TypeAry::make(_elem->meet(a->_elem), + return TypeAry::make(_elem->meet_speculative(a->_elem), _size->xmeet(a->_size)->is_int(), _stable & a->_stable); } @@ -1949,6 +1959,13 @@ return (intptr_t)_elem + (intptr_t)_size + (_stable ? 43 : 0); } +/** + * Return same type without a speculative part in the element + */ +const Type* TypeAry::remove_speculative() const { + return make(_elem->remove_speculative(), _size, _stable); +} + //----------------------interface_vs_oop--------------------------------------- #ifdef ASSERT bool TypeAry::interface_vs_oop(const Type *t) const { @@ -2560,14 +2577,14 @@ return res; } - if (res->isa_oopptr() != NULL) { + const TypeOopPtr* res_oopptr = res->is_oopptr(); + if (res_oopptr->speculative() != NULL) { // type->speculative() == NULL means that speculation is no better // than type, i.e. type->speculative() == type. So there are 2 // ways to represent the fact that we have no useful speculative // data and we should use a single one to be able to test for // equality between types. Check whether type->speculative() == // type and set speculative to NULL if it is the case. - const TypeOopPtr* res_oopptr = res->is_oopptr(); if (res_oopptr->remove_speculative() == res_oopptr->speculative()) { return res_oopptr->remove_speculative(); } @@ -2633,7 +2650,7 @@ case OopPtr: { // Meeting to other OopPtrs const TypeOopPtr *tp = t->is_oopptr(); int instance_id = meet_instance_id(tp->instance_id()); - const TypeOopPtr* speculative = meet_speculative(tp); + const TypeOopPtr* speculative = xmeet_speculative(tp); return make(meet_ptr(tp->ptr()), meet_offset(tp->offset()), instance_id, speculative); } @@ -2787,9 +2804,9 @@ //-----------------------------filter------------------------------------------ // Do not allow interface-vs.-noninterface joins to collapse to top. -const Type *TypeOopPtr::filter(const Type *kills) const { - - const Type* ft = join(kills); +const Type *TypeOopPtr::filter_helper(const Type *kills, bool include_speculative) const { + + const Type* ft = join_helper(kills, include_speculative); const TypeInstPtr* ftip = ft->isa_instptr(); const TypeInstPtr* ktip = kills->isa_instptr(); @@ -2901,7 +2918,10 @@ /** * Return same type without a speculative part */ -const TypeOopPtr* TypeOopPtr::remove_speculative() const { +const Type* TypeOopPtr::remove_speculative() const { + if (_speculative == NULL) { + return this; + } return make(_ptr, _offset, _instance_id, NULL); } @@ -2927,7 +2947,7 @@ * * @param other type to meet with */ -const TypeOopPtr* TypeOopPtr::meet_speculative(const TypeOopPtr* other) const { +const TypeOopPtr* TypeOopPtr::xmeet_speculative(const TypeOopPtr* other) const { bool this_has_spec = (_speculative != NULL); bool other_has_spec = (other->speculative() != NULL); @@ -2952,7 +2972,7 @@ other_spec = other; } - return this_spec->meet(other_spec)->is_oopptr(); + return this_spec->meet_speculative(other_spec)->is_oopptr(); } /** @@ -3111,7 +3131,7 @@ int off = meet_offset(tinst->offset()); PTR ptr = meet_ptr(tinst->ptr()); int instance_id = meet_instance_id(tinst->instance_id()); - const TypeOopPtr* speculative = meet_speculative(tinst); + const TypeOopPtr* speculative = xmeet_speculative(tinst); const TypeInstPtr *loaded = is_loaded() ? this : tinst; const TypeInstPtr *unloaded = is_loaded() ? tinst : this; @@ -3188,7 +3208,7 @@ int offset = meet_offset(tp->offset()); PTR ptr = meet_ptr(tp->ptr()); int instance_id = meet_instance_id(tp->instance_id()); - const TypeOopPtr* speculative = meet_speculative(tp); + const TypeOopPtr* speculative = xmeet_speculative(tp); switch (ptr) { case TopPTR: case AnyNull: // Fall 'down' to dual of object klass @@ -3238,14 +3258,14 @@ case TopPTR: case AnyNull: { int instance_id = meet_instance_id(InstanceTop); - const TypeOopPtr* speculative = meet_speculative(tp); + const TypeOopPtr* speculative = xmeet_speculative(tp); return make(ptr, klass(), klass_is_exact(), (ptr == Constant ? const_oop() : NULL), offset, instance_id, speculative); } case NotNull: case BotPTR: { int instance_id = meet_instance_id(tp->instance_id()); - const TypeOopPtr* speculative = meet_speculative(tp); + const TypeOopPtr* speculative = xmeet_speculative(tp); return TypeOopPtr::make(ptr, offset, instance_id, speculative); } default: typerr(t); @@ -3297,7 +3317,7 @@ int off = meet_offset( tinst->offset() ); PTR ptr = meet_ptr( tinst->ptr() ); int instance_id = meet_instance_id(tinst->instance_id()); - const TypeOopPtr* speculative = meet_speculative(tinst); + const TypeOopPtr* speculative = xmeet_speculative(tinst); // Check for easy case; klasses are equal (and perhaps not loaded!) // If we have constants, then we created oops so classes are loaded @@ -3546,7 +3566,10 @@ return make(_ptr, klass(), klass_is_exact(), const_oop(), xadd_offset(offset), _instance_id, add_offset_speculative(offset)); } -const TypeOopPtr *TypeInstPtr::remove_speculative() const { +const Type *TypeInstPtr::remove_speculative() const { + if (_speculative == NULL) { + return this; + } return make(_ptr, klass(), klass_is_exact(), const_oop(), _offset, _instance_id, NULL); } @@ -3748,14 +3771,14 @@ case TopPTR: case AnyNull: { int instance_id = meet_instance_id(InstanceTop); - const TypeOopPtr* speculative = meet_speculative(tp); + const TypeOopPtr* speculative = xmeet_speculative(tp); return make(ptr, (ptr == Constant ? const_oop() : NULL), _ary, _klass, _klass_is_exact, offset, instance_id, speculative); } case BotPTR: case NotNull: { int instance_id = meet_instance_id(tp->instance_id()); - const TypeOopPtr* speculative = meet_speculative(tp); + const TypeOopPtr* speculative = xmeet_speculative(tp); return TypeOopPtr::make(ptr, offset, instance_id, speculative); } default: ShouldNotReachHere(); @@ -3793,10 +3816,10 @@ case AryPtr: { // Meeting 2 references? const TypeAryPtr *tap = t->is_aryptr(); int off = meet_offset(tap->offset()); - const TypeAry *tary = _ary->meet(tap->_ary)->is_ary(); + const TypeAry *tary = _ary->meet_speculative(tap->_ary)->is_ary(); PTR ptr = meet_ptr(tap->ptr()); int instance_id = meet_instance_id(tap->instance_id()); - const TypeOopPtr* speculative = meet_speculative(tap); + const TypeOopPtr* speculative = xmeet_speculative(tap); ciKlass* lazy_klass = NULL; if (tary->_elem->isa_int()) { // Integral array element types have irrelevant lattice relations. @@ -3876,7 +3899,7 @@ int offset = meet_offset(tp->offset()); PTR ptr = meet_ptr(tp->ptr()); int instance_id = meet_instance_id(tp->instance_id()); - const TypeOopPtr* speculative = meet_speculative(tp); + const TypeOopPtr* speculative = xmeet_speculative(tp); switch (ptr) { case TopPTR: case AnyNull: // Fall 'down' to dual of object klass @@ -3990,8 +4013,8 @@ return make(_ptr, _const_oop, _ary, _klass, _klass_is_exact, xadd_offset(offset), _instance_id, add_offset_speculative(offset)); } -const TypeOopPtr *TypeAryPtr::remove_speculative() const { - return make(_ptr, _const_oop, _ary, _klass, _klass_is_exact, _offset, _instance_id, NULL); +const Type *TypeAryPtr::remove_speculative() const { + return make(_ptr, _const_oop, _ary->remove_speculative()->is_ary(), _klass, _klass_is_exact, _offset, _instance_id, NULL); } //============================================================================= @@ -4031,9 +4054,9 @@ } -const Type *TypeNarrowPtr::filter( const Type *kills ) const { +const Type *TypeNarrowPtr::filter_helper(const Type *kills, bool include_speculative) const { if (isa_same_narrowptr(kills)) { - const Type* ft =_ptrtype->filter(is_same_narrowptr(kills)->_ptrtype); + const Type* ft =_ptrtype->filter_helper(is_same_narrowptr(kills)->_ptrtype, include_speculative); if (ft->empty()) return Type::TOP; // Canonical empty value if (ft->isa_ptr()) { @@ -4041,7 +4064,7 @@ } return ft; } else if (kills->isa_ptr()) { - const Type* ft = _ptrtype->join(kills); + const Type* ft = _ptrtype->join_helper(kills, include_speculative); if (ft->empty()) return Type::TOP; // Canonical empty value return ft; @@ -4171,8 +4194,8 @@ //-----------------------------filter------------------------------------------ // Do not allow interface-vs.-noninterface joins to collapse to top. -const Type *TypeMetadataPtr::filter( const Type *kills ) const { - const TypeMetadataPtr* ft = join(kills)->isa_metadataptr(); +const Type *TypeMetadataPtr::filter_helper(const Type *kills, bool include_speculative) const { + const TypeMetadataPtr* ft = join_helper(kills, include_speculative)->isa_metadataptr(); if (ft == NULL || ft->empty()) return Type::TOP; // Canonical empty value return ft; @@ -4374,10 +4397,10 @@ } // Do not allow interface-vs.-noninterface joins to collapse to top. -const Type *TypeKlassPtr::filter(const Type *kills) const { +const Type *TypeKlassPtr::filter_helper(const Type *kills, bool include_speculative) const { // logic here mirrors the one from TypeOopPtr::filter. See comments // there. - const Type* ft = join(kills); + const Type* ft = join_helper(kills, include_speculative); const TypeKlassPtr* ftkp = ft->isa_klassptr(); const TypeKlassPtr* ktkp = kills->isa_klassptr(); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/opto/type.hpp --- a/src/share/vm/opto/type.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/opto/type.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -164,6 +164,8 @@ virtual bool interface_vs_oop_helper(const Type *t) const; #endif + const Type *meet_helper(const Type *t, bool include_speculative) const; + protected: // Each class of type is also identified by its base. const TYPES _base; // Enum of Types type @@ -171,6 +173,10 @@ Type( TYPES t ) : _dual(NULL), _base(t) {} // Simple types // ~Type(); // Use fast deallocation const Type *hashcons(); // Hash-cons the type + virtual const Type *filter_helper(const Type *kills, bool include_speculative) const; + const Type *join_helper(const Type *t, bool include_speculative) const { + return dual()->meet_helper(t->dual(), include_speculative)->dual(); + } public: @@ -202,10 +208,24 @@ // Test for equivalence of types static int cmp( const Type *const t1, const Type *const t2 ); // Test for higher or equal in lattice - int higher_equal( const Type *t ) const { return !cmp(meet(t),t); } + // Variant that drops the speculative part of the types + int higher_equal(const Type *t) const { + return !cmp(meet(t),t->remove_speculative()); + } + // Variant that keeps the speculative part of the types + int higher_equal_speculative(const Type *t) const { + return !cmp(meet_speculative(t),t); + } // MEET operation; lower in lattice. - const Type *meet( const Type *t ) const; + // Variant that drops the speculative part of the types + const Type *meet(const Type *t) const { + return meet_helper(t, false); + } + // Variant that keeps the speculative part of the types + const Type *meet_speculative(const Type *t) const { + return meet_helper(t, true); + } // WIDEN: 'widens' for Ints and other range types virtual const Type *widen( const Type *old, const Type* limit ) const { return this; } // NARROW: complement for widen, used by pessimistic phases @@ -221,13 +241,26 @@ // JOIN operation; higher in lattice. Done by finding the dual of the // meet of the dual of the 2 inputs. - const Type *join( const Type *t ) const { - return dual()->meet(t->dual())->dual(); } + // Variant that drops the speculative part of the types + const Type *join(const Type *t) const { + return join_helper(t, false); + } + // Variant that keeps the speculative part of the types + const Type *join_speculative(const Type *t) const { + return join_helper(t, true); + } // Modified version of JOIN adapted to the needs Node::Value. // Normalizes all empty values to TOP. Does not kill _widen bits. // Currently, it also works around limitations involving interface types. - virtual const Type *filter( const Type *kills ) const; + // Variant that drops the speculative part of the types + const Type *filter(const Type *kills) const { + return filter_helper(kills, false); + } + // Variant that keeps the speculative part of the types + const Type *filter_speculative(const Type *kills) const { + return filter_helper(kills, true); + } #ifdef ASSERT // One type is interface, the other is oop @@ -383,6 +416,8 @@ // Speculative type. See TypeInstPtr virtual ciKlass* speculative_type() const { return NULL; } + const Type* maybe_remove_speculative(bool include_speculative) const; + virtual const Type* remove_speculative() const { return this; } private: // support arrays @@ -450,12 +485,14 @@ // upper bound, inclusive. class TypeInt : public Type { TypeInt( jint lo, jint hi, int w ); +protected: + virtual const Type *filter_helper(const Type *kills, bool include_speculative) const; + public: virtual bool eq( const Type *t ) const; virtual int hash() const; // Type specific hashing virtual bool singleton(void) const; // TRUE if type is a singleton virtual bool empty(void) const; // TRUE if type is vacuous -public: const jint _lo, _hi; // Lower bound, upper bound const short _widen; // Limit on times we widen this sucker @@ -475,7 +512,6 @@ virtual const Type *widen( const Type *t, const Type* limit_type ) const; virtual const Type *narrow( const Type *t ) const; // Do not kill _widen bits. - virtual const Type *filter( const Type *kills ) const; // Convenience common pre-built types. static const TypeInt *MINUS_1; static const TypeInt *ZERO; @@ -506,6 +542,9 @@ // an upper bound, inclusive. class TypeLong : public Type { TypeLong( jlong lo, jlong hi, int w ); +protected: + // Do not kill _widen bits. + virtual const Type *filter_helper(const Type *kills, bool include_speculative) const; public: virtual bool eq( const Type *t ) const; virtual int hash() const; // Type specific hashing @@ -530,8 +569,6 @@ virtual const Type *xdual() const; // Compute dual right now. virtual const Type *widen( const Type *t, const Type* limit_type ) const; virtual const Type *narrow( const Type *t ) const; - // Do not kill _widen bits. - virtual const Type *filter( const Type *kills ) const; // Convenience common pre-built types. static const TypeLong *MINUS_1; static const TypeLong *ZERO; @@ -622,6 +659,7 @@ virtual const Type *xmeet( const Type *t ) const; virtual const Type *xdual() const; // Compute dual right now. bool ary_must_be_exact() const; // true if arrays of such are never generic + virtual const Type* remove_speculative() const; #ifdef ASSERT // One type is interface, the other is oop virtual bool interface_vs_oop(const Type *t) const; @@ -832,7 +870,7 @@ // utility methods to work on the speculative part of the type const TypeOopPtr* dual_speculative() const; - const TypeOopPtr* meet_speculative(const TypeOopPtr* other) const; + const TypeOopPtr* xmeet_speculative(const TypeOopPtr* other) const; bool eq_speculative(const TypeOopPtr* other) const; int hash_speculative() const; const TypeOopPtr* add_offset_speculative(intptr_t offset) const; @@ -840,6 +878,9 @@ void dump_speculative(outputStream *st) const; #endif + // Do not allow interface-vs.-noninterface joins to collapse to top. + virtual const Type *filter_helper(const Type *kills, bool include_speculative) const; + public: // Creates a type given a klass. Correctly handles multi-dimensional arrays // Respects UseUniqueSubclasses. @@ -895,16 +936,13 @@ virtual const TypePtr *add_offset( intptr_t offset ) const; // Return same type without a speculative part - virtual const TypeOopPtr* remove_speculative() const; + virtual const Type* remove_speculative() const; virtual const Type *xmeet(const Type *t) const; virtual const Type *xdual() const; // Compute dual right now. // the core of the computation of the meet for TypeOopPtr and for its subclasses virtual const Type *xmeet_helper(const Type *t) const; - // Do not allow interface-vs.-noninterface joins to collapse to top. - virtual const Type *filter( const Type *kills ) const; - // Convenience common pre-built type. static const TypeOopPtr *BOTTOM; #ifndef PRODUCT @@ -981,7 +1019,7 @@ virtual const TypePtr *add_offset( intptr_t offset ) const; // Return same type without a speculative part - virtual const TypeOopPtr* remove_speculative() const; + virtual const Type* remove_speculative() const; // the core of the computation of the meet of 2 types virtual const Type *xmeet_helper(const Type *t) const; @@ -1059,7 +1097,7 @@ virtual bool empty(void) const; // TRUE if type is vacuous virtual const TypePtr *add_offset( intptr_t offset ) const; // Return same type without a speculative part - virtual const TypeOopPtr* remove_speculative() const; + virtual const Type* remove_speculative() const; // the core of the computation of the meet of 2 types virtual const Type *xmeet_helper(const Type *t) const; @@ -1100,6 +1138,8 @@ class TypeMetadataPtr : public TypePtr { protected: TypeMetadataPtr(PTR ptr, ciMetadata* metadata, int offset); + // Do not allow interface-vs.-noninterface joins to collapse to top. + virtual const Type *filter_helper(const Type *kills, bool include_speculative) const; public: virtual bool eq( const Type *t ) const; virtual int hash() const; // Type specific hashing @@ -1125,9 +1165,6 @@ virtual intptr_t get_con() const; - // Do not allow interface-vs.-noninterface joins to collapse to top. - virtual const Type *filter( const Type *kills ) const; - // Convenience common pre-built types. static const TypeMetadataPtr *BOTTOM; @@ -1141,6 +1178,8 @@ class TypeKlassPtr : public TypePtr { TypeKlassPtr( PTR ptr, ciKlass* klass, int offset ); +protected: + virtual const Type *filter_helper(const Type *kills, bool include_speculative) const; public: virtual bool eq( const Type *t ) const; virtual int hash() const; // Type specific hashing @@ -1202,9 +1241,6 @@ virtual intptr_t get_con() const; - // Do not allow interface-vs.-noninterface joins to collapse to top. - virtual const Type *filter( const Type *kills ) const; - // Convenience common pre-built types. static const TypeKlassPtr* OBJECT; // Not-null object klass or below static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same @@ -1228,6 +1264,8 @@ virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const = 0; virtual const TypeNarrowPtr *make_same_narrowptr(const TypePtr *t) const = 0; virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const = 0; + // Do not allow interface-vs.-noninterface joins to collapse to top. + virtual const Type *filter_helper(const Type *kills, bool include_speculative) const; public: virtual bool eq( const Type *t ) const; virtual int hash() const; // Type specific hashing @@ -1238,9 +1276,6 @@ virtual intptr_t get_con() const; - // Do not allow interface-vs.-noninterface joins to collapse to top. - virtual const Type *filter( const Type *kills ) const; - virtual bool empty(void) const; // TRUE if type is vacuous // returns the equivalent ptr type for this compressed pointer @@ -1291,6 +1326,10 @@ static const TypeNarrowOop *BOTTOM; static const TypeNarrowOop *NULL_PTR; + virtual const Type* remove_speculative() const { + return make(_ptrtype->remove_speculative()->is_ptr()); + } + #ifndef PRODUCT virtual void dump2( Dict &d, uint depth, outputStream *st ) const; #endif diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/prims/forte.cpp diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/prims/jni.cpp --- a/src/share/vm/prims/jni.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/prims/jni.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -1804,34 +1804,34 @@ // the runtime type of subword integral basic types is integer DEFINE_CALLMETHODV(jboolean, Boolean, T_BOOLEAN - , HOTSPOT_JNI_CALLBOOLEANMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLBOOLEANMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLBOOLEANMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLBOOLEANMETHODV_RETURN(_ret_ref)) DEFINE_CALLMETHODV(jbyte, Byte, T_BYTE - , HOTSPOT_JNI_CALLBYTEMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLBYTEMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLBYTEMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLBYTEMETHODV_RETURN(_ret_ref)) DEFINE_CALLMETHODV(jchar, Char, T_CHAR - , HOTSPOT_JNI_CALLCHARMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLCHARMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLCHARMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLCHARMETHODV_RETURN(_ret_ref)) DEFINE_CALLMETHODV(jshort, Short, T_SHORT - , HOTSPOT_JNI_CALLSHORTMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLSHORTMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLSHORTMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLSHORTMETHODV_RETURN(_ret_ref)) DEFINE_CALLMETHODV(jobject, Object, T_OBJECT - , HOTSPOT_JNI_CALLOBJECTMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLOBJECTMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLOBJECTMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLOBJECTMETHODV_RETURN(_ret_ref)) DEFINE_CALLMETHODV(jint, Int, T_INT, - HOTSPOT_JNI_CALLINTMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLINTMETHOD_RETURN(_ret_ref)) + HOTSPOT_JNI_CALLINTMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLINTMETHODV_RETURN(_ret_ref)) DEFINE_CALLMETHODV(jlong, Long, T_LONG - , HOTSPOT_JNI_CALLLONGMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLLONGMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLLONGMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLLONGMETHODV_RETURN(_ret_ref)) // Float and double probes don't return value because dtrace doesn't currently support it DEFINE_CALLMETHODV(jfloat, Float, T_FLOAT - , HOTSPOT_JNI_CALLFLOATMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLFLOATMETHOD_RETURN()) + , HOTSPOT_JNI_CALLFLOATMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLFLOATMETHODV_RETURN()) DEFINE_CALLMETHODV(jdouble, Double, T_DOUBLE - , HOTSPOT_JNI_CALLDOUBLEMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLDOUBLEMETHOD_RETURN()) + , HOTSPOT_JNI_CALLDOUBLEMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLDOUBLEMETHODV_RETURN()) #define DEFINE_CALLMETHODA(ResultType, Result, Tag \ , EntryProbe, ReturnProbe) \ @@ -1856,34 +1856,34 @@ // the runtime type of subword integral basic types is integer DEFINE_CALLMETHODA(jboolean, Boolean, T_BOOLEAN - , HOTSPOT_JNI_CALLBOOLEANMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLBOOLEANMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLBOOLEANMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLBOOLEANMETHODA_RETURN(_ret_ref)) DEFINE_CALLMETHODA(jbyte, Byte, T_BYTE - , HOTSPOT_JNI_CALLBYTEMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLBYTEMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLBYTEMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLBYTEMETHODA_RETURN(_ret_ref)) DEFINE_CALLMETHODA(jchar, Char, T_CHAR - , HOTSPOT_JNI_CALLCHARMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLCHARMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLCHARMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLCHARMETHODA_RETURN(_ret_ref)) DEFINE_CALLMETHODA(jshort, Short, T_SHORT - , HOTSPOT_JNI_CALLSHORTMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLSHORTMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLSHORTMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLSHORTMETHODA_RETURN(_ret_ref)) DEFINE_CALLMETHODA(jobject, Object, T_OBJECT - , HOTSPOT_JNI_CALLOBJECTMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLOBJECTMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLOBJECTMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLOBJECTMETHODA_RETURN(_ret_ref)) DEFINE_CALLMETHODA(jint, Int, T_INT, - HOTSPOT_JNI_CALLINTMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLINTMETHOD_RETURN(_ret_ref)) + HOTSPOT_JNI_CALLINTMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLINTMETHODA_RETURN(_ret_ref)) DEFINE_CALLMETHODA(jlong, Long, T_LONG - , HOTSPOT_JNI_CALLLONGMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLLONGMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLLONGMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLLONGMETHODA_RETURN(_ret_ref)) // Float and double probes don't return value because dtrace doesn't currently support it DEFINE_CALLMETHODA(jfloat, Float, T_FLOAT - , HOTSPOT_JNI_CALLFLOATMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLFLOATMETHOD_RETURN()) + , HOTSPOT_JNI_CALLFLOATMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLFLOATMETHODA_RETURN()) DEFINE_CALLMETHODA(jdouble, Double, T_DOUBLE - , HOTSPOT_JNI_CALLDOUBLEMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLDOUBLEMETHOD_RETURN()) + , HOTSPOT_JNI_CALLDOUBLEMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLDOUBLEMETHODA_RETURN()) DT_VOID_RETURN_MARK_DECL(CallVoidMethod, HOTSPOT_JNI_CALLVOIDMETHOD_RETURN()); DT_VOID_RETURN_MARK_DECL(CallVoidMethodV, HOTSPOT_JNI_CALLVOIDMETHODV_RETURN()); @@ -3145,7 +3145,7 @@ JNI_END DEFINE_SETSTATICFIELD(jboolean, bool, Boolean, 'Z', z - , HOTSPOT_JNI_SETBOOLEANFIELD_ENTRY(env, clazz, (uintptr_t)fieldID, value), + , HOTSPOT_JNI_SETSTATICBOOLEANFIELD_ENTRY(env, clazz, (uintptr_t)fieldID, value), HOTSPOT_JNI_SETBOOLEANFIELD_RETURN()) DEFINE_SETSTATICFIELD(jbyte, byte, Byte, 'B', b , HOTSPOT_JNI_SETSTATICBYTEFIELD_ENTRY(env, clazz, (uintptr_t) fieldID, value), diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/prims/jvm.cpp --- a/src/share/vm/prims/jvm.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/prims/jvm.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -3971,40 +3971,6 @@ } -// Internal SQE debugging support /////////////////////////////////////////////////////////// - -#ifndef PRODUCT - -extern "C" { - JNIEXPORT jboolean JNICALL JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_get); - JNIEXPORT jboolean JNICALL JVM_AccessVMIntFlag(const char* name, jint* value, jboolean is_get); - JNIEXPORT void JNICALL JVM_VMBreakPoint(JNIEnv *env, jobject obj); -} - -JVM_LEAF(jboolean, JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_get)) - JVMWrapper("JVM_AccessBoolVMFlag"); - return is_get ? CommandLineFlags::boolAt((char*) name, (bool*) value) : CommandLineFlags::boolAtPut((char*) name, (bool*) value, Flag::INTERNAL); -JVM_END - -JVM_LEAF(jboolean, JVM_AccessVMIntFlag(const char* name, jint* value, jboolean is_get)) - JVMWrapper("JVM_AccessVMIntFlag"); - intx v; - jboolean result = is_get ? CommandLineFlags::intxAt((char*) name, &v) : CommandLineFlags::intxAtPut((char*) name, &v, Flag::INTERNAL); - *value = (jint)v; - return result; -JVM_END - - -JVM_ENTRY(void, JVM_VMBreakPoint(JNIEnv *env, jobject obj)) - JVMWrapper("JVM_VMBreakPoint"); - oop the_obj = JNIHandles::resolve(obj); - BREAKPOINT; -JVM_END - - -#endif - - // Method /////////////////////////////////////////////////////////////////////////////////////////// JVM_ENTRY(jobject, JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0)) diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/prims/methodHandles.cpp --- a/src/share/vm/prims/methodHandles.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/prims/methodHandles.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -175,8 +175,8 @@ oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) { assert(info.resolved_appendix().is_null(), "only normal methods here"); - KlassHandle receiver_limit = info.resolved_klass(); methodHandle m = info.resolved_method(); + KlassHandle m_klass = m->method_holder(); int flags = (jushort)( m->access_flags().as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS ); int vmindex = Method::invalid_vtable_index; @@ -184,14 +184,13 @@ case CallInfo::itable_call: vmindex = info.itable_index(); // More importantly, the itable index only works with the method holder. - receiver_limit = m->method_holder(); - assert(receiver_limit->verify_itable_index(vmindex), ""); + assert(m_klass->verify_itable_index(vmindex), ""); flags |= IS_METHOD | (JVM_REF_invokeInterface << REFERENCE_KIND_SHIFT); if (TraceInvokeDynamic) { ResourceMark rm; - tty->print_cr("memberName: invokeinterface method_holder::method: %s, receiver: %s, itableindex: %d, access_flags:", - Method::name_and_sig_as_C_string(receiver_limit(), m->name(), m->signature()), - receiver_limit()->internal_name(), vmindex); + tty->print_cr("memberName: invokeinterface method_holder::method: %s, itableindex: %d, access_flags:", + Method::name_and_sig_as_C_string(m->method_holder(), m->name(), m->signature()), + vmindex); m->access_flags().print_on(tty); if (!m->is_abstract()) { tty->print("default"); @@ -203,12 +202,35 @@ case CallInfo::vtable_call: vmindex = info.vtable_index(); flags |= IS_METHOD | (JVM_REF_invokeVirtual << REFERENCE_KIND_SHIFT); - assert(receiver_limit->is_subtype_of(m->method_holder()), "virtual call must be type-safe"); + assert(info.resolved_klass()->is_subtype_of(m_klass()), "virtual call must be type-safe"); + if (m_klass->is_interface()) { + // This is a vtable call to an interface method (abstract "miranda method" or default method). + // The vtable index is meaningless without a class (not interface) receiver type, so get one. + // (LinkResolver should help us figure this out.) + KlassHandle m_klass_non_interface = info.resolved_klass(); + if (m_klass_non_interface->is_interface()) { + m_klass_non_interface = SystemDictionary::Object_klass(); +#ifdef ASSERT + { ResourceMark rm; + Method* m2 = m_klass_non_interface->vtable()->method_at(vmindex); + assert(m->name() == m2->name() && m->signature() == m2->signature(), + err_msg("at %d, %s != %s", vmindex, + m->name_and_sig_as_C_string(), m2->name_and_sig_as_C_string())); + } +#endif //ASSERT + } + if (!m->is_public()) { + assert(m->is_public(), "virtual call must be to public interface method"); + return NULL; // elicit an error later in product build + } + assert(info.resolved_klass()->is_subtype_of(m_klass_non_interface()), "virtual call must be type-safe"); + m_klass = m_klass_non_interface; + } if (TraceInvokeDynamic) { ResourceMark rm; tty->print_cr("memberName: invokevirtual method_holder::method: %s, receiver: %s, vtableindex: %d, access_flags:", - Method::name_and_sig_as_C_string(receiver_limit(), m->name(), m->signature()), - receiver_limit()->internal_name(), vmindex); + Method::name_and_sig_as_C_string(m->method_holder(), m->name(), m->signature()), + m_klass->internal_name(), vmindex); m->access_flags().print_on(tty); if (m->is_default_method()) { tty->print("default"); @@ -223,10 +245,8 @@ flags |= IS_METHOD | (JVM_REF_invokeStatic << REFERENCE_KIND_SHIFT); } else if (m->is_initializer()) { flags |= IS_CONSTRUCTOR | (JVM_REF_invokeSpecial << REFERENCE_KIND_SHIFT); - assert(receiver_limit == m->method_holder(), "constructor call must be exactly typed"); } else { flags |= IS_METHOD | (JVM_REF_invokeSpecial << REFERENCE_KIND_SHIFT); - assert(receiver_limit->is_subtype_of(m->method_holder()), "special call must be type-safe"); } break; @@ -242,7 +262,7 @@ java_lang_invoke_MemberName::set_flags( mname_oop, flags); java_lang_invoke_MemberName::set_vmtarget(mname_oop, m()); java_lang_invoke_MemberName::set_vmindex( mname_oop, vmindex); // vtable/itable index - java_lang_invoke_MemberName::set_clazz( mname_oop, receiver_limit->java_mirror()); + java_lang_invoke_MemberName::set_clazz( mname_oop, m_klass->java_mirror()); // Note: name and type can be lazily computed by resolve_MemberName, // if Java code needs them as resolved String and MethodType objects. // The clazz must be eagerly stored, because it provides a GC @@ -569,7 +589,7 @@ // An unresolved member name is a mere symbolic reference. // Resolving it plants a vmtarget/vmindex in it, // which refers directly to JVM internals. -Handle MethodHandles::resolve_MemberName(Handle mname, TRAPS) { +Handle MethodHandles::resolve_MemberName(Handle mname, KlassHandle caller, TRAPS) { Handle empty; assert(java_lang_invoke_MemberName::is_instance(mname()), ""); @@ -646,20 +666,20 @@ assert(!HAS_PENDING_EXCEPTION, ""); if (ref_kind == JVM_REF_invokeStatic) { LinkResolver::resolve_static_call(result, - defc, name, type, KlassHandle(), false, false, THREAD); + defc, name, type, caller, caller.not_null(), false, THREAD); } else if (ref_kind == JVM_REF_invokeInterface) { LinkResolver::resolve_interface_call(result, Handle(), defc, - defc, name, type, KlassHandle(), false, false, THREAD); + defc, name, type, caller, caller.not_null(), false, THREAD); } else if (mh_invoke_id != vmIntrinsics::_none) { assert(!is_signature_polymorphic_static(mh_invoke_id), ""); LinkResolver::resolve_handle_call(result, - defc, name, type, KlassHandle(), THREAD); + defc, name, type, caller, THREAD); } else if (ref_kind == JVM_REF_invokeSpecial) { LinkResolver::resolve_special_call(result, - defc, name, type, KlassHandle(), false, THREAD); + defc, name, type, caller, caller.not_null(), THREAD); } else if (ref_kind == JVM_REF_invokeVirtual) { LinkResolver::resolve_virtual_call(result, Handle(), defc, - defc, name, type, KlassHandle(), false, false, THREAD); + defc, name, type, caller, caller.not_null(), false, THREAD); } else { assert(false, err_msg("ref_kind=%d", ref_kind)); } @@ -683,7 +703,7 @@ assert(!HAS_PENDING_EXCEPTION, ""); if (name == vmSymbols::object_initializer_name()) { LinkResolver::resolve_special_call(result, - defc, name, type, KlassHandle(), false, THREAD); + defc, name, type, caller, caller.not_null(), THREAD); } else { break; // will throw after end of switch } @@ -700,7 +720,7 @@ fieldDescriptor result; // find_field initializes fd if found { assert(!HAS_PENDING_EXCEPTION, ""); - LinkResolver::resolve_field(result, defc, name, type, KlassHandle(), Bytecodes::_nop, false, false, THREAD); + LinkResolver::resolve_field(result, defc, name, type, caller, Bytecodes::_nop, false, false, THREAD); if (HAS_PENDING_EXCEPTION) { return empty; } @@ -1121,7 +1141,11 @@ } } - Handle resolved = MethodHandles::resolve_MemberName(mname, CHECK_NULL); + KlassHandle caller(THREAD, + caller_jh == NULL ? (Klass*) NULL : + java_lang_Class::as_Klass(JNIHandles::resolve_non_null(caller_jh))); + Handle resolved = MethodHandles::resolve_MemberName(mname, caller, CHECK_NULL); + if (resolved.is_null()) { int flags = java_lang_invoke_MemberName::flags(mname()); int ref_kind = (flags >> REFERENCE_KIND_SHIFT) & REFERENCE_KIND_MASK; diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/prims/methodHandles.hpp --- a/src/share/vm/prims/methodHandles.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/prims/methodHandles.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -55,7 +55,7 @@ public: // working with member names - static Handle resolve_MemberName(Handle mname, TRAPS); // compute vmtarget/vmindex from name/type + static Handle resolve_MemberName(Handle mname, KlassHandle caller, TRAPS); // compute vmtarget/vmindex from name/type static void expand_MemberName(Handle mname, int suppress, TRAPS); // expand defc/name/type if missing static Handle new_MemberName(TRAPS); // must be followed by init_MemberName static oop init_MemberName(Handle mname_h, Handle target_h); // compute vmtarget/vmindex from target diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/runtime/arguments.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -290,6 +290,7 @@ { "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, { "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) }, { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) }, #ifdef PRODUCT { "DesiredMethodLimit", JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/runtime/globals.cpp --- a/src/share/vm/runtime/globals.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/runtime/globals.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -295,7 +295,7 @@ else st->print("%-16s", ""); } - st->print("%-20"); + st->print("%-20s", " "); print_kind(st); if (withComments) { @@ -702,8 +702,6 @@ return true; } -// Contract: Flag will make private copy of the incoming value. -// Outgoing value is always malloc-ed, and caller MUST call free. bool CommandLineFlags::ccstrAtPut(char* name, size_t len, ccstr* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; @@ -726,7 +724,6 @@ return true; } -// Contract: Flag will make private copy of the incoming value. void CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr value, Flag::Flags origin) { Flag* faddr = address_of_flag(flag); guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type"); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/runtime/globals.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -376,6 +376,8 @@ static bool ccstrAt(char* name, size_t len, ccstr* value); static bool ccstrAt(char* name, ccstr* value) { return ccstrAt(name, strlen(name), value); } + // Contract: Flag will make private copy of the incoming value. + // Outgoing value is always malloc-ed, and caller MUST call free. static bool ccstrAtPut(char* name, size_t len, ccstr* value, Flag::Flags origin); static bool ccstrAtPut(char* name, ccstr* value, Flag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/runtime/globals_extension.hpp --- a/src/share/vm/runtime/globals_extension.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/runtime/globals_extension.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -201,6 +201,7 @@ static void uintxAtPut(CommandLineFlagWithType flag, uintx value, Flag::Flags origin); static void uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, Flag::Flags origin); static void doubleAtPut(CommandLineFlagWithType flag, double value, Flag::Flags origin); + // Contract: Flag will make private copy of the incoming value static void ccstrAtPut(CommandLineFlagWithType flag, ccstr value, Flag::Flags origin); static bool is_default(CommandLineFlag flag); diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/runtime/os.cpp --- a/src/share/vm/runtime/os.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/runtime/os.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -1081,7 +1081,6 @@ } -#ifndef PRODUCT // Check if in metaspace. if (ClassLoaderDataGraph::contains((address)addr)) { // Use addr->print() from the debugger instead (not here) @@ -1089,7 +1088,6 @@ " is pointing into metadata", addr); return; } -#endif // Try an OS specific find if (os::find(addr, st)) { @@ -1264,9 +1262,6 @@ "%/lib/jce.jar:" "%/lib/charsets.jar:" "%/lib/jfr.jar:" -#ifdef __APPLE__ - "%/lib/JObjC.jar:" -#endif "%/classes"; char* sysclasspath = format_boot_path(classpath_format, home, home_len, fileSep, pathSep); if (sysclasspath == NULL) return false; diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/runtime/perfMemory.cpp --- a/src/share/vm/runtime/perfMemory.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/runtime/perfMemory.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -155,7 +155,7 @@ void PerfMemory::destroy() { - assert(_prologue != NULL, "prologue pointer must be initialized"); + if (_prologue == NULL) return; if (_start != NULL && _prologue->overflow != 0) { diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/runtime/synchronizer.cpp --- a/src/share/vm/runtime/synchronizer.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/runtime/synchronizer.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -119,7 +119,7 @@ } \ } -#define HOTSPOT_MONITOR_PROBE_waited HOTSPOT_MONITOR_PROBE_WAITED +#define HOTSPOT_MONITOR_PROBE_waited HOTSPOT_MONITOR_WAITED #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread) \ { \ diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/runtime/thread.cpp --- a/src/share/vm/runtime/thread.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/runtime/thread.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -135,8 +135,8 @@ #else /* USDT2 */ -#define HOTSPOT_THREAD_PROBE_start HOTSPOT_THREAD_PROBE_START -#define HOTSPOT_THREAD_PROBE_stop HOTSPOT_THREAD_PROBE_STOP +#define HOTSPOT_THREAD_PROBE_start HOTSPOT_THREAD_START +#define HOTSPOT_THREAD_PROBE_stop HOTSPOT_THREAD_STOP #define DTRACE_THREAD_PROBE(probe, javathread) \ { \ diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/services/attachListener.cpp --- a/src/share/vm/services/attachListener.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/services/attachListener.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -451,15 +451,39 @@ } } +bool AttachListener::has_init_error(TRAPS) { + if (HAS_PENDING_EXCEPTION) { + tty->print_cr("Exception in VM (AttachListener::init) : "); + java_lang_Throwable::print(PENDING_EXCEPTION, tty); + tty->cr(); + + CLEAR_PENDING_EXCEPTION; + + return true; + } else { + return false; + } +} + // Starts the Attach Listener thread void AttachListener::init() { EXCEPTION_MARK; - Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK); + Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, THREAD); + if (has_init_error(THREAD)) { + return; + } + instanceKlassHandle klass (THREAD, k); - instanceHandle thread_oop = klass->allocate_instance_handle(CHECK); + instanceHandle thread_oop = klass->allocate_instance_handle(THREAD); + if (has_init_error(THREAD)) { + return; + } const char thread_name[] = "Attach Listener"; - Handle string = java_lang_String::create_from_str(thread_name, CHECK); + Handle string = java_lang_String::create_from_str(thread_name, THREAD); + if (has_init_error(THREAD)) { + return; + } // Initialize thread_oop to put it into the system threadGroup Handle thread_group (THREAD, Universe::system_thread_group()); @@ -472,13 +496,7 @@ string, THREAD); - if (HAS_PENDING_EXCEPTION) { - tty->print_cr("Exception in VM (AttachListener::init) : "); - java_lang_Throwable::print(PENDING_EXCEPTION, tty); - tty->cr(); - - CLEAR_PENDING_EXCEPTION; - + if (has_init_error(THREAD)) { return; } @@ -490,14 +508,7 @@ vmSymbols::thread_void_signature(), thread_oop, // ARG 1 THREAD); - - if (HAS_PENDING_EXCEPTION) { - tty->print_cr("Exception in VM (AttachListener::init) : "); - java_lang_Throwable::print(PENDING_EXCEPTION, tty); - tty->cr(); - - CLEAR_PENDING_EXCEPTION; - + if (has_init_error(THREAD)) { return; } diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/services/attachListener.hpp --- a/src/share/vm/services/attachListener.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/services/attachListener.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -94,6 +94,9 @@ // dequeue the next operation static AttachOperation* dequeue(); #endif // !INCLUDE_SERVICES + + private: + static bool has_init_error(TRAPS); }; #if INCLUDE_SERVICES diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/services/diagnosticCommand.cpp --- a/src/share/vm/services/diagnosticCommand.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/services/diagnosticCommand.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "gc_implementation/shared/vmGCOperations.hpp" #include "runtime/javaCalls.hpp" +#include "runtime/os.hpp" #include "services/diagnosticArgument.hpp" #include "services/diagnosticCommand.hpp" #include "services/diagnosticFramework.hpp" @@ -44,6 +45,7 @@ DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); + DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); @@ -610,8 +612,7 @@ } JMXStartLocalDCmd::JMXStartLocalDCmd(outputStream *output, bool heap_allocated) : - DCmd(output, heap_allocated) -{ + DCmd(output, heap_allocated) { // do nothing } @@ -632,7 +633,6 @@ JavaCalls::call_static(&result, ik, vmSymbols::startLocalAgent_name(), vmSymbols::void_method_signature(), CHECK); } - void JMXStopRemoteDCmd::execute(DCmdSource source, TRAPS) { ResourceMark rm(THREAD); HandleMark hm(THREAD); @@ -650,3 +650,12 @@ JavaCalls::call_static(&result, ik, vmSymbols::stopRemoteAgent_name(), vmSymbols::void_method_signature(), CHECK); } +VMDynamicLibrariesDCmd::VMDynamicLibrariesDCmd(outputStream *output, bool heap_allocated) : + DCmd(output, heap_allocated) { + // do nothing +} + +void VMDynamicLibrariesDCmd::execute(DCmdSource source, TRAPS) { + os::print_dll_info(output()); + output()->cr(); +} diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/services/diagnosticCommand.hpp --- a/src/share/vm/services/diagnosticCommand.hpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/services/diagnosticCommand.hpp Sun Jan 26 23:01:57 2014 -0800 @@ -132,6 +132,29 @@ virtual void execute(DCmdSource source, TRAPS); }; +class VMDynamicLibrariesDCmd : public DCmd { +public: + VMDynamicLibrariesDCmd(outputStream* output, bool heap); + static const char* name() { + return "VM.dynlibs"; + } + static const char* description() { + return "Print loaded dynamic libraries."; + } + static const char* impact() { + return "Low"; + } + static const JavaPermission permission() { + JavaPermission p = {"java.lang.management.ManagementPermission", + "monitor", NULL}; + return p; + } + static int num_arguments() { + return 0; + }; + virtual void execute(DCmdSource source, TRAPS); +}; + class VMUptimeDCmd : public DCmdWithParser { protected: DCmdArgument _date; diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/services/jmm.h --- a/src/share/vm/services/jmm.h Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/services/jmm.h Sun Jan 26 23:01:57 2014 -0800 @@ -153,6 +153,7 @@ JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR = 4, /* Set via environment variables */ JMM_VMGLOBAL_ORIGIN_CONFIG_FILE = 5, /* Set via config file (such as .hotspotrc) */ JMM_VMGLOBAL_ORIGIN_ERGONOMIC = 6, /* Set via ergonomic */ + JMM_VMGLOBAL_ORIGIN_ATTACH_ON_DEMAND = 7, /* Set via attach */ JMM_VMGLOBAL_ORIGIN_OTHER = 99 /* Set via some other mechanism */ } jmmVMGlobalOrigin; diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/services/management.cpp --- a/src/share/vm/services/management.cpp Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/services/management.cpp Sun Jan 26 23:01:57 2014 -0800 @@ -1724,6 +1724,9 @@ case Flag::ERGONOMIC: global->origin = JMM_VMGLOBAL_ORIGIN_ERGONOMIC; break; + case Flag::ATTACH_ON_DEMAND: + global->origin = JMM_VMGLOBAL_ORIGIN_ATTACH_ON_DEMAND; + break; default: global->origin = JMM_VMGLOBAL_ORIGIN_OTHER; } @@ -1821,7 +1824,7 @@ "This flag is not writeable."); } - bool succeed; + bool succeed = false; if (flag->is_bool()) { bool bvalue = (new_value.z == JNI_TRUE ? true : false); succeed = CommandLineFlags::boolAtPut(name, &bvalue, Flag::MANAGEMENT); @@ -1841,6 +1844,9 @@ } ccstr svalue = java_lang_String::as_utf8_string(str); succeed = CommandLineFlags::ccstrAtPut(name, &svalue, Flag::MANAGEMENT); + if (succeed) { + FREE_C_HEAP_ARRAY(char, svalue, mtInternal); + } } assert(succeed, "Setting flag should succeed"); JVM_END diff -r 11985e4d4255 -r 303f79ab8e3d src/share/vm/trace/tracetypes.xml --- a/src/share/vm/trace/tracetypes.xml Mon Jan 27 07:54:25 2014 +0100 +++ b/src/share/vm/trace/tracetypes.xml Sun Jan 26 23:01:57 2014 -0800 @@ -85,12 +85,6 @@ - - - - - @@ -116,17 +110,6 @@ - - - - - - - - - - diff -r 11985e4d4255 -r 303f79ab8e3d test/TEST.groups --- a/test/TEST.groups Mon Jan 27 07:54:25 2014 +0100 +++ b/test/TEST.groups Sun Jan 26 23:01:57 2014 -0800 @@ -86,7 +86,8 @@ runtime/RedefineObject/TestRedefineObject.java \ runtime/XCheckJniJsig/XCheckJSig.java \ serviceability/attach/AttachWithStalePidFile.java \ - serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java + serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java \ + serviceability/dcmd/DynLibDcmdTest.java # JRE adds further tests to compact3 diff -r 11985e4d4255 -r 303f79ab8e3d test/compiler/types/TestSpeculationFailedHigherEqual.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/types/TestSpeculationFailedHigherEqual.java Sun Jan 26 23:01:57 2014 -0800 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2014, 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. + */ + +/* + * @test + * @bug 8027422 + * @summary type methods shouldn't always operate on speculative part + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TypeProfileLevel=222 -XX:+UnlockExperimentalVMOptions -XX:+UseTypeSpeculation -XX:-BackgroundCompilation TestSpeculationFailedHigherEqual + * + */ + +public class TestSpeculationFailedHigherEqual { + + static class A { + void m() {} + int i; + } + + static class C extends A { + } + + static C c; + + static A m1(A a, boolean cond) { + // speculative type for a is C not null + if (cond ) { + a = c; + } + // speculative type for a is C (may be null) + int i = a.i; + return a; + } + + static public void main(String[] args) { + C c = new C(); + TestSpeculationFailedHigherEqual.c = c; + for (int i = 0; i < 20000; i++) { + m1(c, i%2 == 0); + } + + System.out.println("TEST PASSED"); + } +} diff -r 11985e4d4255 -r 303f79ab8e3d test/gc/defnew/HeapChangeLogging.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/gc/defnew/HeapChangeLogging.java Sun Jan 26 23:01:57 2014 -0800 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test HeapChangeLogging.java + * @bug 8027440 + * @library /testlibrary + * @build HeapChangeLogging + * @summary Allocate to get a promotion failure and verify that that heap change logging is present. + * @run main HeapChangeLogging + * + * Test the output of G1SummarizeRSetStats in conjunction with G1SummarizeRSetStatsPeriod. + */ + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.oracle.java.testlibrary.*; + +public class HeapChangeLogging { + public static void main(String[] args) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xmx128m", "-Xmn100m", "-XX:+UseSerialGC", "-XX:+PrintGC", "HeapFiller"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + String stdout = output.getStdout(); + System.out.println(stdout); + Matcher stdoutMatcher = Pattern.compile("\\[GC .Allocation Failure.*K->.*K\\(.*K\\), .* secs\\]", Pattern.MULTILINE).matcher(stdout); + if (!stdoutMatcher.find()) { + throw new RuntimeException("No proper GC log line found"); + } + output.shouldHaveExitValue(0); + } +} + +class HeapFiller { + public static Entry root; + private static final int PAYLOAD_SIZE = 1000; + + public static void main(String[] args) { + root = new Entry(PAYLOAD_SIZE, null); + Entry current = root; + try { + while (true) { + Entry newEntry = new Entry(PAYLOAD_SIZE, current); + current = newEntry; + } + } catch (OutOfMemoryError e) { + root = null; + } + + } +} + +class Entry { + public Entry previous; + public byte[] payload; + + Entry(int payloadSize, Entry previous) { + payload = new byte[payloadSize]; + this.previous = previous; + } +} \ No newline at end of file diff -r 11985e4d4255 -r 303f79ab8e3d test/runtime/LoadClass/LoadClassNegative.java --- a/test/runtime/LoadClass/LoadClassNegative.java Mon Jan 27 07:54:25 2014 +0100 +++ b/test/runtime/LoadClass/LoadClassNegative.java Sun Jan 26 23:01:57 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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 @@ -22,7 +22,6 @@ */ /* - * @ignore 8028095 * @test * @key regression * @bug 8020675 diff -r 11985e4d4255 -r 303f79ab8e3d test/runtime/NMT/CommandLineDetail.java --- a/test/runtime/NMT/CommandLineDetail.java Mon Jan 27 07:54:25 2014 +0100 +++ b/test/runtime/NMT/CommandLineDetail.java Sun Jan 26 23:01:57 2014 -0800 @@ -24,7 +24,7 @@ /* * @test * @key nmt - * @summary Running with NMT detail should not result in an error or warning + * @summary Running with NMT detail should not result in an error * @library /testlibrary */ @@ -39,7 +39,6 @@ "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("error"); - output.shouldNotContain("warning"); output.shouldHaveExitValue(0); } } diff -r 11985e4d4255 -r 303f79ab8e3d test/runtime/NMT/CommandLineSummary.java --- a/test/runtime/NMT/CommandLineSummary.java Mon Jan 27 07:54:25 2014 +0100 +++ b/test/runtime/NMT/CommandLineSummary.java Sun Jan 26 23:01:57 2014 -0800 @@ -24,7 +24,7 @@ /* * @test * @key nmt - * @summary Running with NMT summary should not result in an error or warning + * @summary Running with NMT summary should not result in an error * @library /testlibrary */ @@ -39,7 +39,6 @@ "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("error"); - output.shouldNotContain("warning"); output.shouldHaveExitValue(0); } } diff -r 11985e4d4255 -r 303f79ab8e3d test/runtime/NMT/CommandLineTurnOffNMT.java --- a/test/runtime/NMT/CommandLineTurnOffNMT.java Mon Jan 27 07:54:25 2014 +0100 +++ b/test/runtime/NMT/CommandLineTurnOffNMT.java Sun Jan 26 23:01:57 2014 -0800 @@ -24,7 +24,7 @@ /* * @test * @key nmt - * @summary Turning off NMT should not result in an error or warning + * @summary Turning off NMT should not result in an error * @library /testlibrary */ @@ -38,7 +38,6 @@ "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("error"); - output.shouldNotContain("warning"); output.shouldHaveExitValue(0); } } diff -r 11985e4d4255 -r 303f79ab8e3d test/runtime/NMT/PrintNMTStatistics.java --- a/test/runtime/NMT/PrintNMTStatistics.java Mon Jan 27 07:54:25 2014 +0100 +++ b/test/runtime/NMT/PrintNMTStatistics.java Sun Jan 26 23:01:57 2014 -0800 @@ -64,7 +64,6 @@ OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Java Heap (reserved="); output.shouldNotContain("error"); - output.shouldNotContain("warning"); output.shouldHaveExitValue(0); } } diff -r 11985e4d4255 -r 303f79ab8e3d test/runtime/PerfMemDestroy/PerfMemDestroy.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/runtime/PerfMemDestroy/PerfMemDestroy.java Sun Jan 26 23:01:57 2014 -0800 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2014, 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. + */ + +/* + * @test + * @bug 8030955 + * @summary Allow multiple calls to PerfMemory::destroy() without asserting. + * @library /testlibrary + * @run main PerfMemDestroy + */ + +import java.io.File; +import java.util.Map; +import com.oracle.java.testlibrary.*; + +public class PerfMemDestroy { + public static void main(String args[]) throws Throwable { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PerfAllowAtExitRegistration", "-version"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + } +} diff -r 11985e4d4255 -r 303f79ab8e3d test/runtime/XCheckJniJsig/XCheckJSig.java --- a/test/runtime/XCheckJniJsig/XCheckJSig.java Mon Jan 27 07:54:25 2014 +0100 +++ b/test/runtime/XCheckJniJsig/XCheckJSig.java Sun Jan 26 23:01:57 2014 -0800 @@ -22,7 +22,6 @@ */ /* - * @ignore 8023735 * @test * @bug 7051189 8023393 * @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so @@ -30,7 +29,8 @@ * @run main XCheckJSig */ -import java.util.*; +import java.io.File; +import java.util.Map; import com.oracle.java.testlibrary.*; public class XCheckJSig { @@ -47,33 +47,36 @@ String libjsig; String env_var; if (Platform.isOSX()) { - libjsig = jdk_path + "/jre/lib/server/libjsig.dylib"; env_var = "DYLD_INSERT_LIBRARIES"; + libjsig = jdk_path + "/jre/lib/libjsig.dylib"; // jdk location + if (!(new File(libjsig).exists())) { + libjsig = jdk_path + "/lib/libjsig.dylib"; // jre location + } } else { - libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so"; env_var = "LD_PRELOAD"; - } - String java_program; - if (Platform.isSolaris()) { - // On Solaris, need to call the 64-bit Java directly in order for - // LD_PRELOAD to work because libjsig.so is 64-bit. - java_program = jdk_path + "/jre/bin/" + os_arch + "/java"; - } else { - java_program = JDKToolFinder.getJDKTool("java"); + libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so"; // jdk location + if (!(new File(libjsig).exists())) { + libjsig = jdk_path + "/lib/" + os_arch + "/libjsig.so"; // jre location + } } // If this test fails, these might be useful to know. System.out.println("libjsig: " + libjsig); System.out.println("osArch: " + os_arch); - System.out.println("java_program: " + java_program); - ProcessBuilder pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-version"); + // Make sure the libjsig file exists. + if (!(new File(libjsig).exists())) { + System.out.println("File " + libjsig + " not found, skipping"); + return; + } + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-version"); Map env = pb.environment(); env.put(env_var, libjsig); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("libjsig is activated"); output.shouldHaveExitValue(0); - pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-verbose:jni", "-version"); + pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-verbose:jni", "-version"); env = pb.environment(); env.put(env_var, libjsig); output = new OutputAnalyzer(pb.start()); diff -r 11985e4d4255 -r 303f79ab8e3d test/runtime/jsig/Test8017498.sh --- a/test/runtime/jsig/Test8017498.sh Mon Jan 27 07:54:25 2014 +0100 +++ b/test/runtime/jsig/Test8017498.sh Sun Jan 26 23:01:57 2014 -0800 @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2014, 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 @@ -29,6 +29,7 @@ ## @bug 8017498 ## @bug 8020791 ## @bug 8021296 +## @bug 8022301 ## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX ## @run shell/timeout=30 Test8017498.sh ## @@ -42,6 +43,8 @@ ## Adding common setup Variables for running shell tests. . ${TESTSRC}/../../test_env.sh +EXTRA_CFLAG= + # set platform-dependent variables OS=`uname -s` case "$OS" in @@ -57,6 +60,7 @@ MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so else MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}i386${FS}libjsig.so + EXTRA_CFLAG=-m32 fi echo MY_LD_PRELOAD = ${MY_LD_PRELOAD} ;; @@ -72,6 +76,7 @@ ${TESTJAVA}${FS}bin${FS}javac *.java $gcc_cmd -DLINUX -fPIC -shared \ + ${EXTRA_CFLAG} -z noexecstack \ -o ${TESTSRC}${FS}libTestJNI.so \ -I${TESTJAVA}${FS}include \ -I${TESTJAVA}${FS}include${FS}linux \ diff -r 11985e4d4255 -r 303f79ab8e3d test/runtime/memory/ReadFromNoaccessArea.java --- a/test/runtime/memory/ReadFromNoaccessArea.java Mon Jan 27 07:54:25 2014 +0100 +++ b/test/runtime/memory/ReadFromNoaccessArea.java Sun Jan 26 23:01:57 2014 -0800 @@ -22,7 +22,6 @@ */ /* - * @ignore 8028398 * @test * @summary Test that touching noaccess area in class ReservedHeapSpace results in SIGSEGV/ACCESS_VIOLATION * @library /testlibrary /testlibrary/whitebox diff -r 11985e4d4255 -r 303f79ab8e3d test/serviceability/dcmd/DcmdUtil.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/serviceability/dcmd/DcmdUtil.java Sun Jan 26 23:01:57 2014 -0800 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2013 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. + */ + +import sun.management.ManagementFactoryHelper; + +import com.sun.management.DiagnosticCommandMBean; + +public class DcmdUtil +{ + public static String executeDcmd(String cmd, String ... args) { + DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); + Object[] dcmdArgs = {args}; + String[] signature = {String[].class.getName()}; + + try { + System.out.print("> " + cmd + " "); + for (String s : args) { + System.out.print(s + " "); + } + System.out.println(":"); + String result = (String) dcmd.invoke(transform(cmd), dcmdArgs, signature); + System.out.println(result); + return result; + } catch(Exception ex) { + ex.printStackTrace(); + } + return null; + } + + private static String transform(String name) { + StringBuilder sb = new StringBuilder(); + boolean toLower = true; + boolean toUpper = false; + for (int i = 0; i < name.length(); i++) { + char c = name.charAt(i); + if (c == '.' || c == '_') { + toLower = false; + toUpper = true; + } else { + if (toUpper) { + toUpper = false; + sb.append(Character.toUpperCase(c)); + } else if(toLower) { + sb.append(Character.toLowerCase(c)); + } else { + sb.append(c); + } + } + } + return sb.toString(); + } + +} diff -r 11985e4d4255 -r 303f79ab8e3d test/serviceability/dcmd/DynLibDcmdTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/serviceability/dcmd/DynLibDcmdTest.java Sun Jan 26 23:01:57 2014 -0800 @@ -0,0 +1,67 @@ +import java.util.HashSet; +import java.util.Set; +import com.oracle.java.testlibrary.Platform; + +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @summary Test of VM.dynlib diagnostic command via MBean + * @library /testlibrary + * @compile DcmdUtil.java + * @run main DynLibDcmdTest + */ + +public class DynLibDcmdTest { + + public static void main(String[] args) throws Exception { + String result = DcmdUtil.executeDcmd("VM.dynlibs"); + + String osDependentBaseString = null; + if (Platform.isSolaris()) { + osDependentBaseString = "lib%s.so"; + } else if (Platform.isWindows()) { + osDependentBaseString = "%s.dll"; + } else if (Platform.isOSX()) { + osDependentBaseString = "lib%s.dylib"; + } else if (Platform.isLinux()) { + osDependentBaseString = "lib%s.so"; + } + + if (osDependentBaseString == null) { + throw new Exception("Unsupported OS"); + } + + Set expectedContent = new HashSet<>(); + expectedContent.add(String.format(osDependentBaseString, "jvm")); + expectedContent.add(String.format(osDependentBaseString, "java")); + expectedContent.add(String.format(osDependentBaseString, "management")); + + for(String expected : expectedContent) { + if (!result.contains(expected)) { + throw new Exception("Dynamic library list output did not contain the expected string: '" + expected + "'"); + } + } + } +}