# HG changeset patch # User lana # Date 1414097099 25200 # Node ID e7d87caaae2846b220beca98e2ce3fbb0e44386e # Parent c09efaeb7b9f87fe46a559053583ed900d01a904# Parent 5ee40c966315afd814c18cb40ebe3966c6f453a6 Merge diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ObjectMonitor.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ObjectMonitor.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ObjectMonitor.java Thu Oct 23 13:44:59 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2005, 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 @@ -50,8 +50,8 @@ ownerFieldOffset = f.getOffset(); f = type.getField("FreeNext"); FreeNextFieldOffset = f.getOffset(); - countField = type.getCIntegerField("_count"); - waitersField = type.getCIntegerField("_waiters"); + countField = type.getJIntField("_count"); + waitersField = type.getJIntField("_waiters"); recursionsField = type.getCIntegerField("_recursions"); } @@ -81,15 +81,15 @@ // FIXME // void set_owner(void* owner); - public long waiters() { return waitersField.getValue(addr); } + public int waiters() { return waitersField.getValue(addr); } public Address freeNext() { return addr.getAddressAt(FreeNextFieldOffset); } // FIXME // void set_queue(void* owner); - public long count() { return countField.getValue(addr); } + public int count() { return countField.getValue(addr); } // FIXME - // void set_count(intptr_t count); + // void set_count(int count); public long recursions() { return recursionsField.getValue(addr); } @@ -97,18 +97,9 @@ return addr.getOopHandleAt(objectFieldOffset); } - public long contentions() { - // refer to objectMonitor_xxx.inline.hpp - contentions definition. - // for Solaris and Linux, contentions is same as count. for Windows - // it is different (objectMonitor_win32.inline.hpp) - long count = count(); - if (VM.getVM().getOS().equals("win32")) { - // don't count the owner of the monitor - return count > 0? count - 1 : 0; - } else { - // Solaris and Linux - return count; - } + // contentions is always equal to count + public int contentions() { + return count(); } // FIXME @@ -123,8 +114,8 @@ private static long objectFieldOffset; private static long ownerFieldOffset; private static long FreeNextFieldOffset; - private static CIntegerField countField; - private static CIntegerField waitersField; + private static JIntField countField; + private static JIntField waitersField; private static CIntegerField recursionsField; // FIXME: expose platform-dependent stuff } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java Thu Oct 23 13:44:59 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2007, 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 @@ -48,9 +48,17 @@ blockListField = type.getAddressField("gBlockList"); gBlockListAddr = blockListField.getValue(); blockSize = db.lookupIntConstant("ObjectSynchronizer::_BLOCKSIZE").intValue(); + defaultCacheLineSize = db.lookupIntConstant("DEFAULT_CACHE_LINE_SIZE").intValue(); } catch (RuntimeException e) { } type = db.lookupType("ObjectMonitor"); objectMonitorTypeSize = type.getSize(); + if ((objectMonitorTypeSize % defaultCacheLineSize) != 0) { + // sizeof(ObjectMonitor) is not already a multiple of a cache line. + // The ObjectMonitor allocation code in ObjectSynchronizer pads each + // ObjectMonitor in a block to the next cache line boundary. + int needLines = ((int)objectMonitorTypeSize / defaultCacheLineSize) + 1; + objectMonitorTypeSize = needLines * defaultCacheLineSize; + } } public long identityHashValueFor(Oop obj) { @@ -122,6 +130,7 @@ private static Address gBlockListAddr; private static int blockSize; + private static int defaultCacheLineSize; private static long objectMonitorTypeSize; } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/make/aix/makefiles/mapfile-vers-debug --- a/hotspot/make/aix/makefiles/mapfile-vers-debug Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/make/aix/makefiles/mapfile-vers-debug Thu Oct 23 13:44:59 2014 -0700 @@ -32,23 +32,12 @@ 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; @@ -72,7 +61,6 @@ JVM_DefineClassWithSource; JVM_DefineClassWithSourceCond; JVM_DesiredAssertionStatus; - JVM_DisableCompiler; JVM_DoPrivileged; JVM_DTraceGetVersion; JVM_DTraceActivate; @@ -81,8 +69,6 @@ JVM_DTraceDispose; JVM_DumpAllStacks; JVM_DumpThreads; - JVM_EnableCompiler; - JVM_Exit; JVM_FillInStackTrace; JVM_FindClassFromCaller; JVM_FindClassFromClass; @@ -128,16 +114,11 @@ 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; @@ -150,29 +131,22 @@ 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_GetTemporaryDirectory; - 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; @@ -180,18 +154,13 @@ 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; @@ -202,46 +171,27 @@ 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_SetProtectionDomain; - 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; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/make/aix/makefiles/mapfile-vers-product --- a/hotspot/make/aix/makefiles/mapfile-vers-product Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/make/aix/makefiles/mapfile-vers-product Thu Oct 23 13:44:59 2014 -0700 @@ -32,23 +32,12 @@ 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; @@ -72,7 +61,6 @@ JVM_DefineClassWithSource; JVM_DefineClassWithSourceCond; JVM_DesiredAssertionStatus; - JVM_DisableCompiler; JVM_DoPrivileged; JVM_DTraceGetVersion; JVM_DTraceActivate; @@ -81,8 +69,6 @@ JVM_DTraceDispose; JVM_DumpAllStacks; JVM_DumpThreads; - JVM_EnableCompiler; - JVM_Exit; JVM_FillInStackTrace; JVM_FindClassFromCaller; JVM_FindClassFromClass; @@ -128,15 +114,10 @@ JVM_GetDeclaredClasses; JVM_GetDeclaringClass; JVM_GetEnclosingMethodInfo; - JVM_GetFieldAnnotations; JVM_GetFieldIxModifiers; - JVM_GetHostName; JVM_GetInheritedAccessControlContext; JVM_GetInterfaceVersion; - JVM_GetLastErrorString; JVM_GetManagement; - JVM_GetMethodAnnotations; - JVM_GetMethodDefaultAnnotationValue; JVM_GetMethodIxArgsSize; JVM_GetMethodIxByteCode; JVM_GetMethodIxByteCodeLength; @@ -149,28 +130,21 @@ JVM_GetMethodIxModifiers; JVM_GetMethodIxNameUTF; JVM_GetMethodIxSignatureUTF; - JVM_GetMethodParameterAnnotations; JVM_GetMethodParameters; JVM_GetPrimitiveArrayElement; JVM_GetProtectionDomain; - JVM_GetSockName; - JVM_GetSockOpt; JVM_GetStackAccessControlContext; JVM_GetStackTraceDepth; JVM_GetStackTraceElement; JVM_GetSystemPackage; JVM_GetSystemPackages; JVM_GetTemporaryDirectory; - 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; @@ -178,18 +152,13 @@ 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; @@ -200,46 +169,27 @@ 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_SetProtectionDomain; - 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; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug --- a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug Thu Oct 23 13:44:59 2014 -0700 @@ -30,23 +30,12 @@ _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 @@ -70,7 +59,6 @@ _JVM_DefineClassWithSource _JVM_DefineClassWithSourceCond _JVM_DesiredAssertionStatus - _JVM_DisableCompiler _JVM_DoPrivileged _JVM_DTraceGetVersion _JVM_DTraceActivate @@ -79,8 +67,6 @@ _JVM_DTraceDispose _JVM_DumpAllStacks _JVM_DumpThreads - _JVM_EnableCompiler - _JVM_Exit _JVM_FillInStackTrace _JVM_FindClassFromCaller _JVM_FindClassFromClass @@ -126,16 +112,11 @@ _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 @@ -148,29 +129,22 @@ _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_GetTemporaryDirectory - _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 @@ -178,18 +152,13 @@ _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 @@ -200,45 +169,26 @@ _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 diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/make/bsd/makefiles/mapfile-vers-darwin-product --- a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product Thu Oct 23 13:44:59 2014 -0700 @@ -30,23 +30,12 @@ _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 @@ -70,7 +59,6 @@ _JVM_DefineClassWithSource _JVM_DefineClassWithSourceCond _JVM_DesiredAssertionStatus - _JVM_DisableCompiler _JVM_DoPrivileged _JVM_DTraceGetVersion _JVM_DTraceActivate @@ -79,8 +67,6 @@ _JVM_DTraceDispose _JVM_DumpAllStacks _JVM_DumpThreads - _JVM_EnableCompiler - _JVM_Exit _JVM_FillInStackTrace _JVM_FindClassFromCaller _JVM_FindClassFromClass @@ -126,16 +112,11 @@ _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 @@ -148,29 +129,22 @@ _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_GetTemporaryDirectory - _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 @@ -178,18 +152,13 @@ _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 @@ -200,45 +169,26 @@ _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 diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/make/bsd/makefiles/mapfile-vers-debug --- a/hotspot/make/bsd/makefiles/mapfile-vers-debug Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/make/bsd/makefiles/mapfile-vers-debug Thu Oct 23 13:44:59 2014 -0700 @@ -32,23 +32,12 @@ 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; @@ -72,7 +61,6 @@ JVM_DefineClassWithSource; JVM_DefineClassWithSourceCond; JVM_DesiredAssertionStatus; - JVM_DisableCompiler; JVM_DoPrivileged; JVM_DTraceGetVersion; JVM_DTraceActivate; @@ -81,8 +69,6 @@ JVM_DTraceDispose; JVM_DumpAllStacks; JVM_DumpThreads; - JVM_EnableCompiler; - JVM_Exit; JVM_FillInStackTrace; JVM_FindClassFromCaller; JVM_FindClassFromClass; @@ -128,16 +114,11 @@ 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; @@ -150,29 +131,22 @@ 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_GetTemporaryDirectory; - 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; @@ -180,18 +154,13 @@ 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; @@ -202,45 +171,26 @@ 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; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/make/bsd/makefiles/mapfile-vers-product --- a/hotspot/make/bsd/makefiles/mapfile-vers-product Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/make/bsd/makefiles/mapfile-vers-product Thu Oct 23 13:44:59 2014 -0700 @@ -32,23 +32,12 @@ 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; @@ -72,7 +61,6 @@ JVM_DefineClassWithSource; JVM_DefineClassWithSourceCond; JVM_DesiredAssertionStatus; - JVM_DisableCompiler; JVM_DoPrivileged; JVM_DTraceGetVersion; JVM_DTraceActivate; @@ -81,8 +69,6 @@ JVM_DTraceDispose; JVM_DumpAllStacks; JVM_DumpThreads; - JVM_EnableCompiler; - JVM_Exit; JVM_FillInStackTrace; JVM_FindClassFromCaller; JVM_FindClassFromClass; @@ -128,16 +114,11 @@ 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; @@ -150,29 +131,22 @@ 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_GetTemporaryDirectory; - 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; @@ -180,18 +154,13 @@ 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; @@ -202,45 +171,26 @@ 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; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/make/linux/makefiles/mapfile-vers-debug --- a/hotspot/make/linux/makefiles/mapfile-vers-debug Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/make/linux/makefiles/mapfile-vers-debug Thu Oct 23 13:44:59 2014 -0700 @@ -32,23 +32,12 @@ 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; @@ -72,7 +61,6 @@ JVM_DefineClassWithSource; JVM_DefineClassWithSourceCond; JVM_DesiredAssertionStatus; - JVM_DisableCompiler; JVM_DoPrivileged; JVM_DTraceGetVersion; JVM_DTraceActivate; @@ -81,8 +69,6 @@ JVM_DTraceDispose; JVM_DumpAllStacks; JVM_DumpThreads; - JVM_EnableCompiler; - JVM_Exit; JVM_FillInStackTrace; JVM_FindClassFromCaller; JVM_FindClassFromClass; @@ -128,16 +114,11 @@ 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; @@ -150,29 +131,22 @@ 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_GetTemporaryDirectory; - 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; @@ -180,18 +154,13 @@ 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; @@ -202,45 +171,26 @@ 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; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/make/linux/makefiles/mapfile-vers-product --- a/hotspot/make/linux/makefiles/mapfile-vers-product Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/make/linux/makefiles/mapfile-vers-product Thu Oct 23 13:44:59 2014 -0700 @@ -32,23 +32,12 @@ 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; @@ -72,7 +61,6 @@ JVM_DefineClassWithSource; JVM_DefineClassWithSourceCond; JVM_DesiredAssertionStatus; - JVM_DisableCompiler; JVM_DoPrivileged; JVM_DTraceGetVersion; JVM_DTraceActivate; @@ -81,8 +69,6 @@ JVM_DTraceDispose; JVM_DumpAllStacks; JVM_DumpThreads; - JVM_EnableCompiler; - JVM_Exit; JVM_FillInStackTrace; JVM_FindClassFromCaller; JVM_FindClassFromClass; @@ -128,16 +114,11 @@ 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; @@ -150,29 +131,22 @@ 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_GetTemporaryDirectory; - 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; @@ -180,18 +154,13 @@ 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; @@ -202,45 +171,26 @@ 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; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/make/solaris/makefiles/mapfile-vers --- a/hotspot/make/solaris/makefiles/mapfile-vers Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/make/solaris/makefiles/mapfile-vers Thu Oct 23 13:44:59 2014 -0700 @@ -32,23 +32,12 @@ 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; @@ -72,7 +61,6 @@ JVM_DefineClassWithSource; JVM_DefineClassWithSourceCond; JVM_DesiredAssertionStatus; - JVM_DisableCompiler; JVM_DoPrivileged; JVM_DTraceGetVersion; JVM_DTraceActivate; @@ -81,8 +69,6 @@ JVM_DTraceDispose; JVM_DumpAllStacks; JVM_DumpThreads; - JVM_EnableCompiler; - JVM_Exit; JVM_FillInStackTrace; JVM_FindClassFromCaller; JVM_FindClassFromClass; @@ -128,16 +114,11 @@ 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; @@ -150,29 +131,22 @@ 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_GetTemporaryDirectory; - 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; @@ -180,18 +154,13 @@ 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; @@ -202,45 +171,26 @@ 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_solaris_signal; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/make/windows/makefiles/vm.make --- a/hotspot/make/windows/makefiles/vm.make Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/make/windows/makefiles/vm.make Thu Oct 23 13:44:59 2014 -0700 @@ -101,8 +101,6 @@ /export:jio_vsnprintf \ $(AGCT_EXPORT) \ /export:JVM_GetVersionInfo \ - /export:JVM_GetThreadStateNames \ - /export:JVM_GetThreadStateValues \ /export:JVM_InitAgentProperties CXX_INCLUDE_DIRS=/I "..\generated" diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp --- a/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -38,4 +38,26 @@ #define SUPPORTS_NATIVE_CX8 +// The expected size in bytes of a cache line, used to pad data structures. +#if defined(TIERED) + #ifdef _LP64 + // tiered, 64-bit, large machine + #define DEFAULT_CACHE_LINE_SIZE 128 + #else + // tiered, 32-bit, medium machine + #define DEFAULT_CACHE_LINE_SIZE 64 + #endif +#elif defined(COMPILER1) + // pure C1, 32-bit, small machine + #define DEFAULT_CACHE_LINE_SIZE 16 +#elif defined(COMPILER2) || defined(SHARK) + #ifdef _LP64 + // pure C2, 64-bit, large machine + #define DEFAULT_CACHE_LINE_SIZE 128 + #else + // pure C2, 32-bit, medium machine + #define DEFAULT_CACHE_LINE_SIZE 64 + #endif +#endif + #endif // CPU_SPARC_VM_GLOBALDEFINITIONS_SPARC_HPP diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp --- a/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -35,4 +35,27 @@ #define SUPPORTS_NATIVE_CX8 +// The expected size in bytes of a cache line, used to pad data structures. +#if defined(TIERED) + #ifdef _LP64 + // tiered, 64-bit, large machine + #define DEFAULT_CACHE_LINE_SIZE 128 + #else + // tiered, 32-bit, medium machine + #define DEFAULT_CACHE_LINE_SIZE 64 + #endif +#elif defined(COMPILER1) + // pure C1, 32-bit, small machine + // i486 was the last Intel chip with 16-byte cache line size + #define DEFAULT_CACHE_LINE_SIZE 32 +#elif defined(COMPILER2) || defined(SHARK) + #ifdef _LP64 + // pure C2, 64-bit, large machine + #define DEFAULT_CACHE_LINE_SIZE 128 + #else + // pure C2, 32-bit, medium machine + #define DEFAULT_CACHE_LINE_SIZE 64 + #endif +#endif + #endif // CPU_X86_VM_GLOBALDEFINITIONS_X86_HPP diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/os/aix/vm/os_aix.cpp --- a/hotspot/src/os/aix/vm/os_aix.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/os/aix/vm/os_aix.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -4025,14 +4025,6 @@ // This code originates from JDK's sysOpen and open64_w // from src/solaris/hpi/src/system_md.c -#ifndef O_DELETE -#define O_DELETE 0x10000 -#endif - -// Open a file. Unlink the file immediately after open returns -// if the specified oflag has the O_DELETE flag set. -// O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c - int os::open(const char *path, int oflag, int mode) { if (strlen(path) > MAX_PATH - 1) { @@ -4040,8 +4032,6 @@ return -1; } int fd; - int o_delete = (oflag & O_DELETE); - oflag = oflag & ~O_DELETE; fd = ::open64(path, oflag, mode); if (fd == -1) return -1; @@ -4092,9 +4082,6 @@ } #endif - if (o_delete != 0) { - ::unlink(path); - } return fd; } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/os/bsd/dtrace/libjvm_db.c --- a/hotspot/src/os/bsd/dtrace/libjvm_db.c Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/os/bsd/dtrace/libjvm_db.c Thu Oct 23 13:44:59 2014 -0700 @@ -347,10 +347,10 @@ &J->Number_of_heaps, sizeof(J->Number_of_heaps)); /* Allocate memory for heap configurations */ - J->Heap_low = (jvm_agent_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); - J->Heap_high = (jvm_agent_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); - J->Heap_segmap_low = (jvm_agent_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); - J->Heap_segmap_high = (jvm_agent_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); + J->Heap_low = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); + J->Heap_high = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); + J->Heap_segmap_low = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); + J->Heap_segmap_high = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); /* Read code heap configurations */ for (i = 0; i < J->Number_of_heaps; ++i) { diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/os/bsd/vm/os_bsd.cpp --- a/hotspot/src/os/bsd/vm/os_bsd.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -3845,22 +3845,12 @@ // This code originates from JDK's sysOpen and open64_w // from src/solaris/hpi/src/system_md.c -#ifndef O_DELETE - #define O_DELETE 0x10000 -#endif - -// Open a file. Unlink the file immediately after open returns -// if the specified oflag has the O_DELETE flag set. -// O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c - int os::open(const char *path, int oflag, int mode) { if (strlen(path) > MAX_PATH - 1) { errno = ENAMETOOLONG; return -1; } int fd; - int o_delete = (oflag & O_DELETE); - oflag = oflag & ~O_DELETE; fd = ::open(path, oflag, mode); if (fd == -1) return -1; @@ -3913,9 +3903,6 @@ } #endif - if (o_delete != 0) { - ::unlink(path); - } return fd; } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/os/linux/vm/os_linux.cpp --- a/hotspot/src/os/linux/vm/os_linux.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/os/linux/vm/os_linux.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -129,6 +129,7 @@ int (*os::Linux::_clock_gettime)(clockid_t, struct timespec *) = NULL; int (*os::Linux::_pthread_getcpuclockid)(pthread_t, clockid_t *) = NULL; +int (*os::Linux::_pthread_setname_np)(pthread_t, const char*) = NULL; Mutex* os::Linux::_createThread_lock = NULL; pthread_t os::Linux::_main_thread; int os::Linux::_page_size = -1; @@ -4695,6 +4696,11 @@ StackRedPages = 1; StackShadowPages = round_to((StackShadowPages*Linux::vm_default_page_size()), vm_page_size()) / vm_page_size(); } + + // retrieve entry point for pthread_setname_np + Linux::_pthread_setname_np = + (int(*)(pthread_t, const char*))dlsym(RTLD_DEFAULT, "pthread_setname_np"); + } // To install functions for atexit system call @@ -4894,8 +4900,14 @@ } void os::set_native_thread_name(const char *name) { - // Not yet implemented. - return; + if (Linux::_pthread_setname_np) { + char buf [16]; // according to glibc manpage, 16 chars incl. '/0' + snprintf(buf, sizeof(buf), "%s", name); + buf[sizeof(buf) - 1] = '\0'; + const int rc = Linux::_pthread_setname_np(pthread_self(), buf); + // ERANGE should not happen; all other errors should just be ignored. + assert(rc != ERANGE, "pthread_setname_np failed"); + } } bool os::distribute_processes(uint length, uint* distribution) { @@ -5086,22 +5098,12 @@ // This code originates from JDK's sysOpen and open64_w // from src/solaris/hpi/src/system_md.c -#ifndef O_DELETE - #define O_DELETE 0x10000 -#endif - -// Open a file. Unlink the file immediately after open returns -// if the specified oflag has the O_DELETE flag set. -// O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c - int os::open(const char *path, int oflag, int mode) { if (strlen(path) > MAX_PATH - 1) { errno = ENAMETOOLONG; return -1; } int fd; - int o_delete = (oflag & O_DELETE); - oflag = oflag & ~O_DELETE; fd = ::open64(path, oflag, mode); if (fd == -1) return -1; @@ -5154,9 +5156,6 @@ } #endif - if (o_delete != 0) { - ::unlink(path); - } return fd; } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/os/linux/vm/os_linux.hpp --- a/hotspot/src/os/linux/vm/os_linux.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/os/linux/vm/os_linux.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -55,6 +55,7 @@ static int (*_clock_gettime)(clockid_t, struct timespec *); static int (*_pthread_getcpuclockid)(pthread_t, clockid_t *); + static int (*_pthread_setname_np)(pthread_t, const char*); static address _initial_thread_stack_bottom; static uintptr_t _initial_thread_stack_size; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/os/solaris/dtrace/libjvm_db.c --- a/hotspot/src/os/solaris/dtrace/libjvm_db.c Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/os/solaris/dtrace/libjvm_db.c Thu Oct 23 13:44:59 2014 -0700 @@ -347,10 +347,10 @@ &J->Number_of_heaps, sizeof(J->Number_of_heaps)); /* Allocate memory for heap configurations */ - J->Heap_low = (jvm_agent_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); - J->Heap_high = (jvm_agent_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); - J->Heap_segmap_low = (jvm_agent_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); - J->Heap_segmap_high = (jvm_agent_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); + J->Heap_low = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); + J->Heap_high = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); + J->Heap_segmap_low = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); + J->Heap_segmap_high = (uint64_t*)calloc(J->Number_of_heaps, sizeof(uint64_t)); /* Read code heap configurations */ for (i = 0; i < J->Number_of_heaps; ++i) { diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/os/solaris/vm/os_solaris.cpp --- a/hotspot/src/os/solaris/vm/os_solaris.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -4807,22 +4807,12 @@ // This code originates from JDK's sysOpen and open64_w // from src/solaris/hpi/src/system_md.c -#ifndef O_DELETE - #define O_DELETE 0x10000 -#endif - -// Open a file. Unlink the file immediately after open returns -// if the specified oflag has the O_DELETE flag set. -// O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c - int os::open(const char *path, int oflag, int mode) { if (strlen(path) > MAX_PATH - 1) { errno = ENAMETOOLONG; return -1; } int fd; - int o_delete = (oflag & O_DELETE); - oflag = oflag & ~O_DELETE; fd = ::open64(path, oflag, mode); if (fd == -1) return -1; @@ -4918,9 +4908,6 @@ } #endif - if (o_delete != 0) { - ::unlink(path); - } return fd; } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/os/windows/vm/jvm_windows.h --- a/hotspot/src/os/windows/vm/jvm_windows.h Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/os/windows/vm/jvm_windows.h Thu Oct 23 13:44:59 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -116,7 +116,6 @@ #define JVM_O_O_APPEND O_APPEND #define JVM_O_EXCL O_EXCL #define JVM_O_CREAT O_CREAT -#define JVM_O_DELETE O_TEMPORARY /* Signals */ diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/os/windows/vm/os_windows.cpp --- a/hotspot/src/os/windows/vm/os_windows.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/os/windows/vm/os_windows.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -745,8 +745,29 @@ } void os::set_native_thread_name(const char *name) { - // Not yet implemented. - return; + + // See: http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx + // + // Note that unfortunately this only works if the process + // is already attached to a debugger; debugger must observe + // the exception below to show the correct name. + + const DWORD MS_VC_EXCEPTION = 0x406D1388; + struct { + DWORD dwType; // must be 0x1000 + LPCSTR szName; // pointer to name (in user addr space) + DWORD dwThreadID; // thread ID (-1=caller thread) + DWORD dwFlags; // reserved for future use, must be zero + } info; + + info.dwType = 0x1000; + info.szName = name; + info.dwThreadID = -1; + info.dwFlags = 0; + + __try { + RaiseException (MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(DWORD), (const ULONG_PTR*)&info ); + } __except(EXCEPTION_CONTINUE_EXECUTION) {} } bool os::distribute_processes(uint length, uint* distribution) { diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java --- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java Thu Oct 23 13:44:59 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -410,8 +410,6 @@ "/export:jio_fprintf /export:jio_vfprintf "+ "/export:jio_vsnprintf "+ "/export:JVM_GetVersionInfo "+ - "/export:JVM_GetThreadStateNames "+ - "/export:JVM_GetThreadStateValues "+ "/export:JVM_InitAgentProperties"); addAttr(rv, "AdditionalDependencies", "kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;Wsock32.lib;winmm.lib;psapi.lib"); addAttr(rv, "OutputFile", outDll); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/ci/ciMethod.cpp --- a/hotspot/src/share/vm/ci/ciMethod.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/ci/ciMethod.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -1116,6 +1116,7 @@ template bool ciMethod::has_option_value(const char* option, uintx& value); template bool ciMethod::has_option_value(const char* option, bool& value); template bool ciMethod::has_option_value(const char* option, ccstr& value); +template bool ciMethod::has_option_value(const char* option, double& value); // ------------------------------------------------------------------ // ciMethod::can_be_compiled diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/classfile/verifier.cpp --- a/hotspot/src/share/vm/classfile/verifier.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/classfile/verifier.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -98,6 +98,19 @@ HandleMark hm; ResourceMark rm(THREAD); + // Eagerly allocate the identity hash code for a klass. This is a fallout + // from 6320749 and 8059924: hash code generator is not supposed to be called + // during the safepoint, but it allows to sneak the hashcode in during + // verification. Without this eager hashcode generation, we may end up + // installing the hashcode during some other operation, which may be at + // safepoint -- blowing up the checks. It was previously done as the side + // effect (sic!) for external_name(), but instead of doing that, we opt to + // explicitly push the hashcode in here. This is signify the following block + // is IMPORTANT: + if (klass->java_mirror() != NULL) { + klass->java_mirror()->identity_hash(); + } + if (!is_eligible_for_verification(klass, should_verify_class)) { return true; } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/compiler/compilerOracle.cpp --- a/hotspot/src/share/vm/compiler/compilerOracle.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -173,6 +173,7 @@ UintxType, BoolType, CcstrType, + DoubleType, UnknownType }; @@ -198,6 +199,10 @@ return CcstrType; } +template<> OptionType get_type_for() { + return DoubleType; +} + template static const T copy_value(const T value) { return value; @@ -297,6 +302,15 @@ tty->cr(); }; +template<> +void TypedMethodOptionMatcher::print() { + ttyLocker ttyl; + print_base(); + tty->print(" double %s", _option); + tty->print(" = %f", _value); + tty->cr(); +}; + // this must parallel the command_names below enum OracleCommand { UnknownCommand = -1, @@ -390,6 +404,7 @@ template bool CompilerOracle::has_option_value(methodHandle method, const char* option, uintx& value); template bool CompilerOracle::has_option_value(methodHandle method, const char* option, bool& value); template bool CompilerOracle::has_option_value(methodHandle method, const char* option, ccstr& value); +template bool CompilerOracle::has_option_value(methodHandle method, const char* option, double& value); bool CompilerOracle::should_exclude(methodHandle method, bool& quietly) { quietly = true; @@ -610,6 +625,20 @@ } else { jio_snprintf(errorbuf, sizeof(errorbuf), " Value cannot be read for flag %s of type %s", flag, type); } + } else if (strcmp(type, "double") == 0) { + char buffer[2][256]; + // Decimal separator '.' has been replaced with ' ' or '/' earlier, + // so read integer and fraction part of double value separately. + if (sscanf(line, "%*[ \t]%255[0-9]%*[ /\t]%255[0-9]%n", buffer[0], buffer[1], &bytes_read) == 2) { + char value[512] = ""; + strncat(value, buffer[0], 255); + strcat(value, "."); + strncat(value, buffer[1], 255); + total_bytes_read += bytes_read; + return add_option_string(c_name, c_match, m_name, m_match, signature, flag, atof(value)); + } else { + jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); + } } else { jio_snprintf(errorbuf, sizeof(errorbuf), " Type %s not supported ", type); } @@ -700,11 +729,10 @@ // (1) CompileCommand=option,Klass::method,flag // (2) CompileCommand=option,Klass::method,type,flag,value // - // Type (1) is used to support ciMethod::has_option("someflag") - // (i.e., to check if a flag "someflag" is enabled for a method). + // Type (1) is used to enable a boolean flag for a method. // // Type (2) is used to support options with a value. Values can have the - // the following types: intx, uintx, bool, ccstr, and ccstrlist. + // the following types: intx, uintx, bool, ccstr, ccstrlist, and double. // // For future extensions: extend scan_flag_and_value() char option[256]; // stores flag for Type (1) and type of Type (2) @@ -722,6 +750,7 @@ || strcmp(option, "bool") == 0 || strcmp(option, "ccstr") == 0 || strcmp(option, "ccstrlist") == 0 + || strcmp(option, "double") == 0 ) { // Type (2) option: parse flag name and value. diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -131,7 +131,10 @@ storage->set_mapping_changed_listener(&_listener); } -void CMBitMapMappingChangedListener::on_commit(uint start_region, size_t num_regions) { +void CMBitMapMappingChangedListener::on_commit(uint start_region, size_t num_regions, bool zero_filled) { + if (zero_filled) { + return; + } // We need to clear the bitmap on commit, removing any existing information. MemRegion mr(G1CollectedHeap::heap()->bottom_addr_for_region(start_region), num_regions * HeapRegion::GrainWords); _bm->clearRange(mr); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -127,7 +127,7 @@ void set_bitmap(CMBitMap* bm) { _bm = bm; } - virtual void on_commit(uint start_idx, size_t num_regions); + virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled); }; class CMBitMap : public CMBitMapRO { diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -109,7 +109,7 @@ class G1BlockOffsetSharedArrayMappingChangedListener : public G1MappingChangedListener { public: - virtual void on_commit(uint start_idx, size_t num_regions) { + virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled) { // Nothing to do. The BOT is hard-wired to be part of the HeapRegion, and we cannot // retrieve it here since this would cause firing of several asserts. The code // executed after commit of a region already needs to do some re-initialization of diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -33,7 +33,10 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC -void G1CardCountsMappingChangedListener::on_commit(uint start_idx, size_t num_regions) { +void G1CardCountsMappingChangedListener::on_commit(uint start_idx, size_t num_regions, bool zero_filled) { + if (zero_filled) { + return; + } MemRegion mr(G1CollectedHeap::heap()->bottom_addr_for_region(start_idx), num_regions * HeapRegion::GrainWords); _counts->clear_range(mr); } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -42,7 +42,7 @@ public: void set_cardcounts(G1CardCounts* counts) { _counts = counts; } - virtual void on_commit(uint start_idx, size_t num_regions); + virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled); }; // Table to track the number of times a card has been refined. Once diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -389,7 +389,9 @@ OtherRegionsTable::invalidate(start_idx, num_regions); } -void G1RegionMappingChangedListener::on_commit(uint start_idx, size_t num_regions) { +void G1RegionMappingChangedListener::on_commit(uint start_idx, size_t num_regions, bool zero_filled) { + // The from card cache is not the memory that is actually committed. So we cannot + // take advantage of the zero_filled parameter. reset_from_card_cache(start_idx, num_regions); } @@ -3610,7 +3612,7 @@ cl.candidate_humongous()); _has_humongous_reclaim_candidates = cl.candidate_humongous() > 0; - if (_has_humongous_reclaim_candidates) { + if (_has_humongous_reclaim_candidates || G1TraceReclaimDeadHumongousObjectsAtYoungGC) { clear_humongous_is_live_table(); } } @@ -4096,7 +4098,7 @@ _hrm.verify_optional(); verify_region_sets_optional(); - TASKQUEUE_STATS_ONLY(if (ParallelGCVerbose) print_taskqueue_stats()); + TASKQUEUE_STATS_ONLY(if (PrintTaskqueue) print_taskqueue_stats()); TASKQUEUE_STATS_ONLY(reset_taskqueue_stats()); print_heap_after_gc(); @@ -4666,7 +4668,7 @@ _g1h->g1_policy()->record_thread_age_table(pss.age_table()); _g1h->update_surviving_young_words(pss.surviving_young_words()+1); - if (ParallelGCVerbose) { + if (PrintTerminationStats) { MutexLocker x(stats_lock()); pss.print_termination_stats(worker_id); } @@ -5760,7 +5762,7 @@ if (G1CollectedHeap::use_parallel_gc_threads()) { // The individual threads will set their evac-failure closures. - if (ParallelGCVerbose) G1ParScanThreadState::print_termination_stats_hdr(); + if (PrintTerminationStats) G1ParScanThreadState::print_termination_stats_hdr(); // These tasks use ShareHeap::_process_strong_tasks assert(UseDynamicNumberOfGCThreads || workers()->active_workers() == workers()->total_workers(), @@ -6272,9 +6274,10 @@ g1h->humongous_region_is_always_live(region_idx)) { if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) { - gclog_or_tty->print_cr("Live humongous %d region %d with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d live-other %d obj array %d", + gclog_or_tty->print_cr("Live humongous %d region %d size "SIZE_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d live-other %d obj array %d", r->is_humongous(), region_idx, + obj->size()*HeapWordSize, r->rem_set()->occupied(), r->rem_set()->strong_code_roots_list_length(), next_bitmap->isMarked(r->bottom()), @@ -6291,8 +6294,9 @@ r->bottom())); if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) { - gclog_or_tty->print_cr("Reclaim humongous region %d start "PTR_FORMAT" region %d length "UINT32_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d live-other %d obj array %d", + gclog_or_tty->print_cr("Reclaim humongous region %d size "SIZE_FORMAT" start "PTR_FORMAT" region %d length "UINT32_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d live-other %d obj array %d", r->is_humongous(), + obj->size()*HeapWordSize, r->bottom(), region_idx, r->region_num(), @@ -6331,7 +6335,8 @@ void G1CollectedHeap::eagerly_reclaim_humongous_regions() { assert_at_safepoint(true); - if (!G1ReclaimDeadHumongousObjectsAtYoungGC || !_has_humongous_reclaim_candidates) { + if (!G1ReclaimDeadHumongousObjectsAtYoungGC || + (!_has_humongous_reclaim_candidates && !G1TraceReclaimDeadHumongousObjectsAtYoungGC)) { g1_policy()->phase_times()->record_fast_reclaim_humongous_time_ms(0.0, 0); return; } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -172,7 +172,7 @@ private: void reset_from_card_cache(uint start_idx, size_t num_regions); public: - virtual void on_commit(uint start_idx, size_t num_regions); + virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled); }; class G1CollectedHeap : public SharedHeap { diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -69,7 +69,7 @@ virtual void commit_regions(uintptr_t start_idx, size_t num_regions) { _storage.commit(start_idx * _pages_per_region, num_regions * _pages_per_region); _commit_map.set_range(start_idx, start_idx + num_regions); - fire_on_commit(start_idx, num_regions); + fire_on_commit(start_idx, num_regions, true); } virtual void uncommit_regions(uintptr_t start_idx, size_t num_regions) { @@ -115,12 +115,14 @@ assert(!_commit_map.at(i), err_msg("Trying to commit storage at region "INTPTR_FORMAT" that is already committed", i)); uintptr_t idx = region_idx_to_page_idx(i); uint old_refcount = _refcounts.get_by_index(idx); + bool zero_filled = false; if (old_refcount == 0) { _storage.commit(idx, 1); + zero_filled = true; } _refcounts.set_by_index(idx, old_refcount + 1); _commit_map.set_bit(i); - fire_on_commit(i, 1); + fire_on_commit(i, 1, zero_filled); } } @@ -139,9 +141,9 @@ } }; -void G1RegionToSpaceMapper::fire_on_commit(uint start_idx, size_t num_regions) { +void G1RegionToSpaceMapper::fire_on_commit(uint start_idx, size_t num_regions, bool zero_filled) { if (_listener != NULL) { - _listener->on_commit(start_idx, num_regions); + _listener->on_commit(start_idx, num_regions, zero_filled); } } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -33,7 +33,9 @@ public: // Fired after commit of the memory, i.e. the memory this listener is registered // for can be accessed. - virtual void on_commit(uint start_idx, size_t num_regions) = 0; + // Zero_filled indicates that the memory can be considered as filled with zero bytes + // when called. + virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled) = 0; }; // Maps region based commit/uncommit requests to the underlying page sized virtual @@ -51,7 +53,7 @@ G1RegionToSpaceMapper(ReservedSpace rs, size_t commit_granularity, size_t region_granularity, MemoryType type); - void fire_on_commit(uint start_idx, size_t num_regions); + void fire_on_commit(uint start_idx, size_t num_regions, bool zero_filled); public: MemRegion reserved() { return _storage.reserved(); } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -125,7 +125,8 @@ } #endif -void G1SATBCardTableLoggingModRefBSChangedListener::on_commit(uint start_idx, size_t num_regions) { +void G1SATBCardTableLoggingModRefBSChangedListener::on_commit(uint start_idx, size_t num_regions, bool zero_filled) { + // Default value for a clean card on the card table is -1. So we cannot take advantage of the zero_filled parameter. MemRegion mr(G1CollectedHeap::heap()->bottom_addr_for_region(start_idx), num_regions * HeapRegion::GrainWords); _card_table->clear(mr); } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -136,7 +136,7 @@ void set_card_table(G1SATBCardTableLoggingModRefBS* card_table) { _card_table = card_table; } - virtual void on_commit(uint start_idx, size_t num_regions); + virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled); }; // Adds card-table logging to the post-barrier. diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -1065,10 +1065,8 @@ gch->print_heap_change(gch_prev_used); } - if (PrintGCDetails && ParallelGCVerbose) { - TASKQUEUE_STATS_ONLY(thread_state_set.print_termination_stats()); - TASKQUEUE_STATS_ONLY(thread_state_set.print_taskqueue_stats()); - } + TASKQUEUE_STATS_ONLY(if (PrintTerminationStats) thread_state_set.print_termination_stats()); + TASKQUEUE_STATS_ONLY(if (PrintTaskqueue) thread_state_set.print_taskqueue_stats()); if (UseAdaptiveSizePolicy) { size_policy->minor_collection_end(gch->gc_cause()); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -91,7 +91,7 @@ bool PSPromotionManager::post_scavenge(YoungGCTracer& gc_tracer) { bool promotion_failure_occurred = false; - TASKQUEUE_STATS_ONLY(if (PrintGCDetails && ParallelGCVerbose) print_stats()); + TASKQUEUE_STATS_ONLY(if (PrintTaskqueue) print_taskqueue_stats()); for (uint i = 0; i < ParallelGCThreads + 1; i++) { PSPromotionManager* manager = manager_array(i); assert(manager->claimed_stack_depth()->is_empty(), "should be empty"); @@ -106,16 +106,9 @@ #if TASKQUEUE_STATS void -PSPromotionManager::print_taskqueue_stats(uint i) const { - tty->print("%3u ", i); - _claimed_stack_depth.stats.print(); - tty->cr(); -} - -void -PSPromotionManager::print_local_stats(uint i) const { +PSPromotionManager::print_local_stats(outputStream* const out, uint i) const { #define FMT " " SIZE_FORMAT_W(10) - tty->print_cr("%3u" FMT FMT FMT FMT, i, _masked_pushes, _masked_steals, + out->print_cr("%3u" FMT FMT FMT FMT, i, _masked_pushes, _masked_steals, _arrays_chunked, _array_chunks_processed); #undef FMT } @@ -127,20 +120,24 @@ }; void -PSPromotionManager::print_stats() { - tty->print_cr("== GC Tasks Stats, GC %3d", +PSPromotionManager::print_taskqueue_stats(outputStream* const out) { + out->print_cr("== GC Tasks Stats, GC %3d", Universe::heap()->total_collections()); - tty->print("thr "); TaskQueueStats::print_header(1); tty->cr(); - tty->print("--- "); TaskQueueStats::print_header(2); tty->cr(); + TaskQueueStats totals; + out->print("thr "); TaskQueueStats::print_header(1, out); out->cr(); + out->print("--- "); TaskQueueStats::print_header(2, out); out->cr(); for (uint i = 0; i < ParallelGCThreads + 1; ++i) { - manager_array(i)->print_taskqueue_stats(i); + TaskQueueStats& next = manager_array(i)->_claimed_stack_depth.stats; + out->print("%3d ", i); next.print(out); out->cr(); + totals += next; } + out->print("tot "); totals.print(out); out->cr(); const uint hlines = sizeof(pm_stats_hdr) / sizeof(pm_stats_hdr[0]); - for (uint i = 0; i < hlines; ++i) tty->print_cr("%s", pm_stats_hdr[i]); + for (uint i = 0; i < hlines; ++i) out->print_cr("%s", pm_stats_hdr[i]); for (uint i = 0; i < ParallelGCThreads + 1; ++i) { - manager_array(i)->print_local_stats(i); + manager_array(i)->print_local_stats(out, i); } } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -68,9 +68,8 @@ size_t _arrays_chunked; size_t _array_chunks_processed; - void print_taskqueue_stats(uint i) const; - void print_local_stats(uint i) const; - static void print_stats(); + void print_local_stats(outputStream* const out, uint i) const; + static void print_taskqueue_stats(outputStream* const out = gclog_or_tty); void reset_stats(); #endif // TASKQUEUE_STATS diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/memory/padded.hpp --- a/hotspot/src/share/vm/memory/padded.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/memory/padded.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -76,10 +76,16 @@ // if the start address is a multiple of alignment. template class PaddedEnd : public PaddedEndImpl { - // C++ don't allow zero-length arrays. The padding is put in a + // C++ doesn't allow zero-length arrays. The padding is put in a // super class that is specialized for the pad_size == 0 case. }; +// Similar to PaddedEnd, this macro defines a _pad_buf#id field +// that is (alignment - size) bytes in size. This macro is used +// to add padding in between non-class fields in a class or struct. +#define DEFINE_PAD_MINUS_SIZE(id, alignment, size) \ + char _pad_buf##id[(alignment) - (size)] + // Helper class to create an array of PaddedEnd objects. All elements will // start at a multiple of alignment and the size will be aligned to alignment. template diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/opto/bytecodeInfo.cpp --- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -298,10 +298,19 @@ if (is_init_with_ea(callee_method, caller_method, C)) { // Escape Analysis: inline all executed constructors return false; - } else if (!callee_method->was_executed_more_than(MIN2(MinInliningThreshold, - CompileThreshold >> 1))) { - set_msg("executed < MinInliningThreshold times"); - return true; + } else { + intx counter_high_value; + // Tiered compilation uses a different "high value" than non-tiered compilation. + // Determine the right value to use. + if (TieredCompilation) { + counter_high_value = InvocationCounter::count_limit / 2; + } else { + counter_high_value = CompileThreshold / 2; + } + if (!callee_method->was_executed_more_than(MIN2(MinInliningThreshold, counter_high_value))) { + set_msg("executed < MinInliningThreshold times"); + return true; + } } } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/opto/c2_globals.hpp --- a/hotspot/src/share/vm/opto/c2_globals.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/opto/c2_globals.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -343,10 +343,16 @@ product(bool, UseRDPCForConstantTableBase, false, \ "Use Sparc RDPC instruction for the constant table base.") \ \ - develop(intx, PrintIdealGraphLevel, 0, \ + develop(bool, PrintIdealGraph, false, \ "Print ideal graph to XML file / network interface. " \ "By default attempts to connect to the visualizer on a socket.") \ \ + develop(intx, PrintIdealGraphLevel, 0, \ + "Level of detail of the ideal graph printout. " \ + "System-wide value, 0=nothing is printed, 3=all details printed. "\ + "Level of detail of printouts can be set on a per-method level " \ + "as well by using CompileCommand=option.") \ + \ develop(intx, PrintIdealGraphPort, 4444, \ "Ideal graph printer to network port") \ \ diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/opto/compile.cpp --- a/hotspot/src/share/vm/opto/compile.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/opto/compile.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -827,7 +827,7 @@ // Drain the list. Finish_Warm(); #ifndef PRODUCT - if (_printer) { + if (_printer && _printer->should_print(_method)) { _printer->print_inlining(this); } #endif diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/opto/compile.hpp --- a/hotspot/src/share/vm/opto/compile.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/opto/compile.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -622,7 +622,9 @@ void begin_method() { #ifndef PRODUCT - if (_printer) _printer->begin_method(this); + if (_printer && _printer->should_print(_method)) { + _printer->begin_method(this); + } #endif C->_latest_stage_start_counter.stamp(); } @@ -639,7 +641,9 @@ #ifndef PRODUCT - if (_printer) _printer->print_method(this, CompilerPhaseTypeHelper::to_string(cpt), level); + if (_printer && _printer->should_print(_method)) { + _printer->print_method(this, CompilerPhaseTypeHelper::to_string(cpt), level); + } #endif C->_latest_stage_start_counter.stamp(); } @@ -654,7 +658,9 @@ event.commit(); } #ifndef PRODUCT - if (_printer) _printer->end_method(); + if (_printer && _printer->should_print(_method)) { + _printer->end_method(); + } #endif } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/opto/escape.cpp --- a/hotspot/src/share/vm/opto/escape.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/opto/escape.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -882,9 +882,14 @@ assert(false, "should be done already"); break; #endif + case Op_ArrayCopy: case Op_CallLeafNoFP: - is_arraycopy = (call->as_CallLeaf()->_name != NULL && - strstr(call->as_CallLeaf()->_name, "arraycopy") != 0); + // Most array copies are ArrayCopy nodes at this point but there + // are still a few direct calls to the copy subroutines (See + // PhaseStringOpts::copy_string()) + is_arraycopy = (call->Opcode() == Op_ArrayCopy) || + (call->as_CallLeaf()->_name != NULL && + strstr(call->as_CallLeaf()->_name, "arraycopy") != 0); // fall through case Op_CallLeaf: { // Stub calls, objects do not escape but they are not scale replaceable. @@ -894,6 +899,9 @@ for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { const Type* at = d->field_at(i); Node *arg = call->in(i); + if (arg == NULL) { + continue; + } const Type *aat = _igvn->type(arg); if (arg->is_top() || !at->isa_ptr() || !aat->isa_ptr()) continue; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/opto/graphKit.cpp --- a/hotspot/src/share/vm/opto/graphKit.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/opto/graphKit.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -3826,6 +3826,110 @@ // Final sync IdealKit and GraphKit. final_sync(ideal); } +/* + * Determine if the G1 pre-barrier can be removed. The pre-barrier is + * required by SATB to make sure all objects live at the start of the + * marking are kept alive, all reference updates need to any previous + * reference stored before writing. + * + * If the previous value is NULL there is no need to save the old value. + * References that are NULL are filtered during runtime by the barrier + * code to avoid unnecessary queuing. + * + * However in the case of newly allocated objects it might be possible to + * prove that the reference about to be overwritten is NULL during compile + * time and avoid adding the barrier code completely. + * + * The compiler needs to determine that the object in which a field is about + * to be written is newly allocated, and that no prior store to the same field + * has happened since the allocation. + * + * Returns true if the pre-barrier can be removed + */ +bool GraphKit::g1_can_remove_pre_barrier(PhaseTransform* phase, Node* adr, + BasicType bt, uint adr_idx) { + intptr_t offset = 0; + Node* base = AddPNode::Ideal_base_and_offset(adr, phase, offset); + AllocateNode* alloc = AllocateNode::Ideal_allocation(base, phase); + + if (offset == Type::OffsetBot) { + return false; // cannot unalias unless there are precise offsets + } + + if (alloc == NULL) { + return false; // No allocation found + } + + intptr_t size_in_bytes = type2aelembytes(bt); + + Node* mem = memory(adr_idx); // start searching here... + + for (int cnt = 0; cnt < 50; cnt++) { + + if (mem->is_Store()) { + + Node* st_adr = mem->in(MemNode::Address); + intptr_t st_offset = 0; + Node* st_base = AddPNode::Ideal_base_and_offset(st_adr, phase, st_offset); + + if (st_base == NULL) { + break; // inscrutable pointer + } + + // Break we have found a store with same base and offset as ours so break + if (st_base == base && st_offset == offset) { + break; + } + + if (st_offset != offset && st_offset != Type::OffsetBot) { + const int MAX_STORE = BytesPerLong; + if (st_offset >= offset + size_in_bytes || + st_offset <= offset - MAX_STORE || + st_offset <= offset - mem->as_Store()->memory_size()) { + // Success: The offsets are provably independent. + // (You may ask, why not just test st_offset != offset and be done? + // The answer is that stores of different sizes can co-exist + // in the same sequence of RawMem effects. We sometimes initialize + // a whole 'tile' of array elements with a single jint or jlong.) + mem = mem->in(MemNode::Memory); + continue; // advance through independent store memory + } + } + + if (st_base != base + && MemNode::detect_ptr_independence(base, alloc, st_base, + AllocateNode::Ideal_allocation(st_base, phase), + phase)) { + // Success: The bases are provably independent. + mem = mem->in(MemNode::Memory); + continue; // advance through independent store memory + } + } else if (mem->is_Proj() && mem->in(0)->is_Initialize()) { + + InitializeNode* st_init = mem->in(0)->as_Initialize(); + AllocateNode* st_alloc = st_init->allocation(); + + // Make sure that we are looking at the same allocation site. + // The alloc variable is guaranteed to not be null here from earlier check. + if (alloc == st_alloc) { + // Check that the initialization is storing NULL so that no previous store + // has been moved up and directly write a reference + Node* captured_store = st_init->find_captured_store(offset, + type2aelembytes(T_OBJECT), + phase); + if (captured_store == NULL || captured_store == st_init->zero_memory()) { + return true; + } + } + } + + // Unless there is an explicit 'continue', we must bail out here, + // because 'mem' is an inscrutable memory state (e.g., a call). + break; + } + + return false; +} // G1 pre/post barriers void GraphKit::g1_write_barrier_pre(bool do_load, @@ -3846,6 +3950,12 @@ assert(adr != NULL, "where are loading from?"); assert(pre_val == NULL, "loaded already?"); assert(val_type != NULL, "need a type"); + + if (use_ReduceInitialCardMarks() + && g1_can_remove_pre_barrier(&_gvn, adr, bt, alias_idx)) { + return; + } + } else { // In this case both val_type and alias_idx are unused. assert(pre_val != NULL, "must be loaded already"); @@ -3927,6 +4037,65 @@ final_sync(ideal); } +/* + * G1 similar to any GC with a Young Generation requires a way to keep track of + * references from Old Generation to Young Generation to make sure all live + * objects are found. G1 also requires to keep track of object references + * between different regions to enable evacuation of old regions, which is done + * as part of mixed collections. References are tracked in remembered sets and + * is continuously updated as reference are written to with the help of the + * post-barrier. + * + * To reduce the number of updates to the remembered set the post-barrier + * filters updates to fields in objects located in the Young Generation, + * the same region as the reference, when the NULL is being written or + * if the card is already marked as dirty by an earlier write. + * + * Under certain circumstances it is possible to avoid generating the + * post-barrier completely if it is possible during compile time to prove + * the object is newly allocated and that no safepoint exists between the + * allocation and the store. + * + * In the case of slow allocation the allocation code must handle the barrier + * as part of the allocation in the case the allocated object is not located + * in the nursery, this would happen for humongous objects. This is similar to + * how CMS is required to handle this case, see the comments for the method + * CollectedHeap::new_store_pre_barrier and OptoRuntime::new_store_pre_barrier. + * A deferred card mark is required for these objects and handled in the above + * mentioned methods. + * + * Returns true if the post barrier can be removed + */ +bool GraphKit::g1_can_remove_post_barrier(PhaseTransform* phase, Node* store, + Node* adr) { + intptr_t offset = 0; + Node* base = AddPNode::Ideal_base_and_offset(adr, phase, offset); + AllocateNode* alloc = AllocateNode::Ideal_allocation(base, phase); + + if (offset == Type::OffsetBot) { + return false; // cannot unalias unless there are precise offsets + } + + if (alloc == NULL) { + return false; // No allocation found + } + + // Start search from Store node + Node* mem = store->in(MemNode::Control); + if (mem->is_Proj() && mem->in(0)->is_Initialize()) { + + InitializeNode* st_init = mem->in(0)->as_Initialize(); + AllocateNode* st_alloc = st_init->allocation(); + + // Make sure we are looking at the same allocation + if (alloc == st_alloc) { + return true; + } + } + + return false; +} + // // Update the card table and add card address to the queue // @@ -3979,6 +4148,20 @@ return; } + if (use_ReduceInitialCardMarks() && obj == just_allocated_object(control())) { + // We can skip marks on a freshly-allocated object in Eden. + // Keep this code in sync with new_store_pre_barrier() in runtime.cpp. + // That routine informs GC to take appropriate compensating steps, + // upon a slow-path allocation, so as to make this card-mark + // elision safe. + return; + } + + if (use_ReduceInitialCardMarks() + && g1_can_remove_post_barrier(&_gvn, oop_store, adr)) { + return; + } + if (!use_precise) { // All card marks for a (non-array) instance are in one place: adr = obj; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/opto/graphKit.hpp --- a/hotspot/src/share/vm/opto/graphKit.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/opto/graphKit.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -771,6 +771,10 @@ Node* index, Node* index_adr, Node* buffer, const TypeFunc* tf); + bool g1_can_remove_pre_barrier(PhaseTransform* phase, Node* adr, BasicType bt, uint adr_idx); + + bool g1_can_remove_post_barrier(PhaseTransform* phase, Node* store, Node* adr); + public: // Helper function to round double arguments before a call void round_double_arguments(ciMethod* dest_method); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/opto/idealGraphPrinter.cpp --- a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -73,7 +73,9 @@ int IdealGraphPrinter::_file_count = 0; IdealGraphPrinter *IdealGraphPrinter::printer() { - if (PrintIdealGraphLevel == 0) return NULL; + if (!PrintIdealGraph) { + return NULL; + } JavaThread *thread = JavaThread::current(); if (!thread->is_Compiler_thread()) return NULL; @@ -193,7 +195,6 @@ } } - void IdealGraphPrinter::begin_elem(const char *s) { _xml->begin_elem("%s", s); } @@ -680,7 +681,7 @@ // Print current ideal graph void IdealGraphPrinter::print(Compile* compile, const char *name, Node *node, int level, bool clear_nodes) { - if (!_current_method || !_should_send_method || level > PrintIdealGraphLevel) return; + if (!_current_method || !_should_send_method || !should_print(_current_method, level)) return; this->C = compile; @@ -732,6 +733,13 @@ output()->flush(); } +// Should method be printed? +bool IdealGraphPrinter::should_print(ciMethod* method, int level) { + intx ideal_graph_level = PrintIdealGraphLevel; + method->has_option_value("PrintIdealGraphLevel", ideal_graph_level); // update value with per-method value (if available) + return ideal_graph_level >= level; +} + extern const char *NodeClassNames[]; outputStream *IdealGraphPrinter::output() { diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/opto/idealGraphPrinter.hpp --- a/hotspot/src/share/vm/opto/idealGraphPrinter.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/opto/idealGraphPrinter.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -134,6 +134,7 @@ void print_method(Compile* compile, const char *name, int level=1, bool clear_nodes = false); void print(Compile* compile, const char *name, Node *root, int level=1, bool clear_nodes = false); void print_xml(const char *name); + static bool should_print(ciMethod* method, int level = 1); }; #endif diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/opto/parse2.cpp --- a/hotspot/src/share/vm/opto/parse2.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/opto/parse2.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -2344,7 +2344,7 @@ #ifndef PRODUCT IdealGraphPrinter *printer = IdealGraphPrinter::printer(); - if(printer) { + if (printer && printer->should_print(_method)) { char buffer[256]; sprintf(buffer, "Bytecode %d: %s", bci(), Bytecodes::name(bc())); bool old = printer->traverse_outs(); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/prims/jvm.cpp --- a/hotspot/src/share/vm/prims/jvm.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/prims/jvm.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -415,27 +415,12 @@ extern volatile jint vm_created; -JVM_ENTRY_NO_ENV(void, JVM_Exit(jint code)) - if (vm_created != 0 && (code == 0)) { - // The VM is about to exit. We call back into Java to check whether finalizers should be run - Universe::run_finalizers_on_exit(); - } - before_exit(thread); - vm_exit(code); -JVM_END - - JVM_ENTRY_NO_ENV(void, JVM_Halt(jint code)) before_exit(thread); vm_exit(code); JVM_END -JVM_LEAF(void, JVM_OnExit(void (*func)(void))) - register_on_exit_function(func); -JVM_END - - JVM_ENTRY_NO_ENV(void, JVM_GC(void)) JVMWrapper("JVM_GC"); if (!DisableExplicitGC) { @@ -450,15 +435,6 @@ JVM_END -JVM_LEAF(void, JVM_TraceInstructions(jboolean on)) - if (PrintJVMWarnings) warning("JVM_TraceInstructions not supported"); -JVM_END - - -JVM_LEAF(void, JVM_TraceMethodCalls(jboolean on)) - if (PrintJVMWarnings) warning("JVM_TraceMethodCalls not supported"); -JVM_END - static inline jlong convert_size_t_to_jlong(size_t val) { // In the 64-bit vm, a size_t can overflow a jlong (which is signed). NOT_LP64 (return (jlong)val;) @@ -628,60 +604,6 @@ return JNIHandles::make_local(env, oop(new_obj)); JVM_END -// java.lang.Compiler //////////////////////////////////////////////////// - -// The initial cuts of the HotSpot VM will not support JITs, and all existing -// JITs would need extensive changes to work with HotSpot. The JIT-related JVM -// functions are all silently ignored unless JVM warnings are printed. - -JVM_LEAF(void, JVM_InitializeCompiler (JNIEnv *env, jclass compCls)) - if (PrintJVMWarnings) warning("JVM_InitializeCompiler not supported"); -JVM_END - - -JVM_LEAF(jboolean, JVM_IsSilentCompiler(JNIEnv *env, jclass compCls)) - if (PrintJVMWarnings) warning("JVM_IsSilentCompiler not supported"); - return JNI_FALSE; -JVM_END - - -JVM_LEAF(jboolean, JVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls)) - if (PrintJVMWarnings) warning("JVM_CompileClass not supported"); - return JNI_FALSE; -JVM_END - - -JVM_LEAF(jboolean, JVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname)) - if (PrintJVMWarnings) warning("JVM_CompileClasses not supported"); - return JNI_FALSE; -JVM_END - - -JVM_LEAF(jobject, JVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg)) - if (PrintJVMWarnings) warning("JVM_CompilerCommand not supported"); - return NULL; -JVM_END - - -JVM_LEAF(void, JVM_EnableCompiler(JNIEnv *env, jclass compCls)) - if (PrintJVMWarnings) warning("JVM_EnableCompiler not supported"); -JVM_END - - -JVM_LEAF(void, JVM_DisableCompiler(JNIEnv *env, jclass compCls)) - if (PrintJVMWarnings) warning("JVM_DisableCompiler not supported"); -JVM_END - - - -// Error message support ////////////////////////////////////////////////////// - -JVM_LEAF(jint, JVM_GetLastErrorString(char *buf, int len)) - JVMWrapper("JVM_GetLastErrorString"); - return (jint)os::lasterror(buf, len); -JVM_END - - // java.io.File /////////////////////////////////////////////////////////////// JVM_LEAF(char*, JVM_NativePath(char* path)) @@ -757,12 +679,6 @@ JVM_END -JVM_ENTRY(void, JVM_ResolveClass(JNIEnv* env, jclass cls)) - JVMWrapper("JVM_ResolveClass"); - if (PrintJVMWarnings) warning("JVM_ResolveClass not implemented"); -JVM_END - - // Returns a class loaded by the bootstrap class loader; or null // if not found. ClassNotFoundException is not thrown. // @@ -1651,21 +1567,6 @@ return true; } -JVM_ENTRY(jbyteArray, JVM_GetFieldAnnotations(JNIEnv *env, jobject field)) - // field is a handle to a java.lang.reflect.Field object - assert(field != NULL, "illegal field"); - JVMWrapper("JVM_GetFieldAnnotations"); - - fieldDescriptor fd; - bool gotFd = jvm_get_field_common(field, fd, CHECK_NULL); - if (!gotFd) { - return NULL; - } - - return (jbyteArray) JNIHandles::make_local(env, Annotations::make_java_array(fd.annotations(), THREAD)); -JVM_END - - static Method* jvm_get_method_common(jobject method) { // some of this code was adapted from from jni_FromReflectedMethod @@ -1689,48 +1590,6 @@ return m; // caller has to deal with NULL in product mode } - -JVM_ENTRY(jbyteArray, JVM_GetMethodAnnotations(JNIEnv *env, jobject method)) - JVMWrapper("JVM_GetMethodAnnotations"); - - // method is a handle to a java.lang.reflect.Method object - Method* m = jvm_get_method_common(method); - if (m == NULL) { - return NULL; - } - - return (jbyteArray) JNIHandles::make_local(env, - Annotations::make_java_array(m->annotations(), THREAD)); -JVM_END - - -JVM_ENTRY(jbyteArray, JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method)) - JVMWrapper("JVM_GetMethodDefaultAnnotationValue"); - - // method is a handle to a java.lang.reflect.Method object - Method* m = jvm_get_method_common(method); - if (m == NULL) { - return NULL; - } - - return (jbyteArray) JNIHandles::make_local(env, - Annotations::make_java_array(m->annotation_default(), THREAD)); -JVM_END - - -JVM_ENTRY(jbyteArray, JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method)) - JVMWrapper("JVM_GetMethodParameterAnnotations"); - - // method is a handle to a java.lang.reflect.Method object - Method* m = jvm_get_method_common(method); - if (m == NULL) { - return NULL; - } - - return (jbyteArray) JNIHandles::make_local(env, - Annotations::make_java_array(m->parameter_annotations(), THREAD)); -JVM_END - /* Type use annotations support (JDK 1.8) */ JVM_ENTRY(jbyteArray, JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls)) @@ -2717,77 +2576,6 @@ return (jboolean) Reflection::is_same_class_package(klass1, klass2); JVM_END - -// IO functions //////////////////////////////////////////////////////////////////////////////////////// - -JVM_LEAF(jint, JVM_Open(const char *fname, jint flags, jint mode)) - JVMWrapper2("JVM_Open (%s)", fname); - - //%note jvm_r6 - int result = os::open(fname, flags, mode); - if (result >= 0) { - return result; - } else { - switch(errno) { - case EEXIST: - return JVM_EEXIST; - default: - return -1; - } - } -JVM_END - - -JVM_LEAF(jint, JVM_Close(jint fd)) - JVMWrapper2("JVM_Close (0x%x)", fd); - //%note jvm_r6 - return os::close(fd); -JVM_END - - -JVM_LEAF(jint, JVM_Read(jint fd, char *buf, jint nbytes)) - JVMWrapper2("JVM_Read (0x%x)", fd); - - //%note jvm_r6 - return (jint)os::restartable_read(fd, buf, nbytes); -JVM_END - - -JVM_LEAF(jint, JVM_Write(jint fd, char *buf, jint nbytes)) - JVMWrapper2("JVM_Write (0x%x)", fd); - - //%note jvm_r6 - return (jint)os::write(fd, buf, nbytes); -JVM_END - - -JVM_LEAF(jint, JVM_Available(jint fd, jlong *pbytes)) - JVMWrapper2("JVM_Available (0x%x)", fd); - //%note jvm_r6 - return os::available(fd, pbytes); -JVM_END - - -JVM_LEAF(jlong, JVM_Lseek(jint fd, jlong offset, jint whence)) - JVMWrapper4("JVM_Lseek (0x%x, " INT64_FORMAT ", %d)", fd, (int64_t) offset, whence); - //%note jvm_r6 - return os::lseek(fd, offset, whence); -JVM_END - - -JVM_LEAF(jint, JVM_SetLength(jint fd, jlong length)) - JVMWrapper3("JVM_SetLength (0x%x, " INT64_FORMAT ")", fd, (int64_t) length); - return os::ftruncate(fd, length); -JVM_END - - -JVM_LEAF(jint, JVM_Sync(jint fd)) - JVMWrapper2("JVM_Sync (0x%x)", fd); - //%note jvm_r6 - return os::fsync(fd); -JVM_END - - // Printing support ////////////////////////////////////////////////// extern "C" { @@ -3459,96 +3247,6 @@ return (!access.is_private() && InstanceKlass::cast(current_class)->is_same_class_package(field_class)); } - -// JVM_AllocateNewObject and JVM_AllocateNewArray are unused as of 1.4 -JVM_ENTRY(jobject, JVM_AllocateNewObject(JNIEnv *env, jobject receiver, jclass currClass, jclass initClass)) - JVMWrapper("JVM_AllocateNewObject"); - JvmtiVMObjectAllocEventCollector oam; - // Receiver is not used - oop curr_mirror = JNIHandles::resolve_non_null(currClass); - oop init_mirror = JNIHandles::resolve_non_null(initClass); - - // Cannot instantiate primitive types - if (java_lang_Class::is_primitive(curr_mirror) || java_lang_Class::is_primitive(init_mirror)) { - ResourceMark rm(THREAD); - THROW_0(vmSymbols::java_lang_InvalidClassException()); - } - - // Arrays not allowed here, must use JVM_AllocateNewArray - if (java_lang_Class::as_Klass(curr_mirror)->oop_is_array() || - java_lang_Class::as_Klass(init_mirror)->oop_is_array()) { - ResourceMark rm(THREAD); - THROW_0(vmSymbols::java_lang_InvalidClassException()); - } - - instanceKlassHandle curr_klass (THREAD, java_lang_Class::as_Klass(curr_mirror)); - instanceKlassHandle init_klass (THREAD, java_lang_Class::as_Klass(init_mirror)); - - assert(curr_klass->is_subclass_of(init_klass()), "just checking"); - - // Interfaces, abstract classes, and java.lang.Class classes cannot be instantiated directly. - curr_klass->check_valid_for_instantiation(false, CHECK_NULL); - - // Make sure klass is initialized, since we are about to instantiate one of them. - curr_klass->initialize(CHECK_NULL); - - methodHandle m (THREAD, - init_klass->find_method(vmSymbols::object_initializer_name(), - vmSymbols::void_method_signature())); - if (m.is_null()) { - ResourceMark rm(THREAD); - THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), - Method::name_and_sig_as_C_string(init_klass(), - vmSymbols::object_initializer_name(), - vmSymbols::void_method_signature())); - } - - if (curr_klass == init_klass && !m->is_public()) { - // Calling the constructor for class 'curr_klass'. - // Only allow calls to a public no-arg constructor. - // This path corresponds to creating an Externalizable object. - THROW_0(vmSymbols::java_lang_IllegalAccessException()); - } - - if (!force_verify_field_access(curr_klass(), init_klass(), m->access_flags(), false)) { - // subclass 'curr_klass' does not have access to no-arg constructor of 'initcb' - THROW_0(vmSymbols::java_lang_IllegalAccessException()); - } - - Handle obj = curr_klass->allocate_instance_handle(CHECK_NULL); - // Call constructor m. This might call a constructor higher up in the hierachy - JavaCalls::call_default_constructor(thread, m, obj, CHECK_NULL); - - return JNIHandles::make_local(obj()); -JVM_END - - -JVM_ENTRY(jobject, JVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass, jint length)) - JVMWrapper("JVM_AllocateNewArray"); - JvmtiVMObjectAllocEventCollector oam; - oop mirror = JNIHandles::resolve_non_null(currClass); - - if (java_lang_Class::is_primitive(mirror)) { - THROW_0(vmSymbols::java_lang_InvalidClassException()); - } - Klass* k = java_lang_Class::as_Klass(mirror); - oop result; - - if (k->oop_is_typeArray()) { - // typeArray - result = TypeArrayKlass::cast(k)->allocate(length, CHECK_NULL); - } else if (k->oop_is_objArray()) { - // objArray - ObjArrayKlass* oak = ObjArrayKlass::cast(k); - oak->initialize(CHECK_NULL); // make sure class is initialized (matches Classic VM behavior) - result = oak->allocate(length, CHECK_NULL); - } else { - THROW_0(vmSymbols::java_lang_InvalidClassException()); - } - return JNIHandles::make_local(env, result); -JVM_END - - // Return the first non-null class loader up the execution stack, or null // if only code from the null class loader is on the stack. @@ -3564,60 +3262,6 @@ JVM_END -// Load a class relative to the most recent class on the stack with a non-null -// classloader. -// This function has been deprecated and should not be considered part of the -// specified JVM interface. - -JVM_ENTRY(jclass, JVM_LoadClass0(JNIEnv *env, jobject receiver, - jclass currClass, jstring currClassName)) - JVMWrapper("JVM_LoadClass0"); - // Receiver is not used - ResourceMark rm(THREAD); - - // Class name argument is not guaranteed to be in internal format - Handle classname (THREAD, JNIHandles::resolve_non_null(currClassName)); - Handle string = java_lang_String::internalize_classname(classname, CHECK_NULL); - - const char* str = java_lang_String::as_utf8_string(string()); - - if (str == NULL || (int)strlen(str) > Symbol::max_length()) { - // It's impossible to create this class; the name cannot fit - // into the constant pool. - THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), str); - } - - TempNewSymbol name = SymbolTable::new_symbol(str, CHECK_NULL); - Handle curr_klass (THREAD, JNIHandles::resolve(currClass)); - // Find the most recent class on the stack with a non-null classloader - oop loader = NULL; - oop protection_domain = NULL; - if (curr_klass.is_null()) { - for (vframeStream vfst(thread); - !vfst.at_end() && loader == NULL; - vfst.next()) { - if (!vfst.method()->is_native()) { - InstanceKlass* holder = vfst.method()->method_holder(); - loader = holder->class_loader(); - protection_domain = holder->protection_domain(); - } - } - } else { - Klass* curr_klass_oop = java_lang_Class::as_Klass(curr_klass()); - loader = InstanceKlass::cast(curr_klass_oop)->class_loader(); - protection_domain = InstanceKlass::cast(curr_klass_oop)->protection_domain(); - } - Handle h_loader(THREAD, loader); - Handle h_prot (THREAD, protection_domain); - jclass result = find_class_from_class_loader(env, name, true, h_loader, h_prot, - false, thread); - if (TraceClassResolution && result != NULL) { - trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result))); - } - return result; -JVM_END - - // Array /////////////////////////////////////////////////////////////////////////////////////////// @@ -3713,143 +3357,6 @@ JVM_END -// Networking library support //////////////////////////////////////////////////////////////////// - -JVM_LEAF(jint, JVM_InitializeSocketLibrary()) - JVMWrapper("JVM_InitializeSocketLibrary"); - return 0; -JVM_END - - -JVM_LEAF(jint, JVM_Socket(jint domain, jint type, jint protocol)) - JVMWrapper("JVM_Socket"); - return os::socket(domain, type, protocol); -JVM_END - - -JVM_LEAF(jint, JVM_SocketClose(jint fd)) - JVMWrapper2("JVM_SocketClose (0x%x)", fd); - //%note jvm_r6 - return os::socket_close(fd); -JVM_END - - -JVM_LEAF(jint, JVM_SocketShutdown(jint fd, jint howto)) - JVMWrapper2("JVM_SocketShutdown (0x%x)", fd); - //%note jvm_r6 - return os::socket_shutdown(fd, howto); -JVM_END - - -JVM_LEAF(jint, JVM_Recv(jint fd, char *buf, jint nBytes, jint flags)) - JVMWrapper2("JVM_Recv (0x%x)", fd); - //%note jvm_r6 - return os::recv(fd, buf, (size_t)nBytes, (uint)flags); -JVM_END - - -JVM_LEAF(jint, JVM_Send(jint fd, char *buf, jint nBytes, jint flags)) - JVMWrapper2("JVM_Send (0x%x)", fd); - //%note jvm_r6 - return os::send(fd, buf, (size_t)nBytes, (uint)flags); -JVM_END - - -JVM_LEAF(jint, JVM_Timeout(int fd, long timeout)) - JVMWrapper2("JVM_Timeout (0x%x)", fd); - //%note jvm_r6 - return os::timeout(fd, timeout); -JVM_END - - -JVM_LEAF(jint, JVM_Listen(jint fd, jint count)) - JVMWrapper2("JVM_Listen (0x%x)", fd); - //%note jvm_r6 - return os::listen(fd, count); -JVM_END - - -JVM_LEAF(jint, JVM_Connect(jint fd, struct sockaddr *him, jint len)) - JVMWrapper2("JVM_Connect (0x%x)", fd); - //%note jvm_r6 - return os::connect(fd, him, (socklen_t)len); -JVM_END - - -JVM_LEAF(jint, JVM_Bind(jint fd, struct sockaddr *him, jint len)) - JVMWrapper2("JVM_Bind (0x%x)", fd); - //%note jvm_r6 - return os::bind(fd, him, (socklen_t)len); -JVM_END - - -JVM_LEAF(jint, JVM_Accept(jint fd, struct sockaddr *him, jint *len)) - JVMWrapper2("JVM_Accept (0x%x)", fd); - //%note jvm_r6 - socklen_t socklen = (socklen_t)(*len); - jint result = os::accept(fd, him, &socklen); - *len = (jint)socklen; - return result; -JVM_END - - -JVM_LEAF(jint, JVM_RecvFrom(jint fd, char *buf, int nBytes, int flags, struct sockaddr *from, int *fromlen)) - JVMWrapper2("JVM_RecvFrom (0x%x)", fd); - //%note jvm_r6 - socklen_t socklen = (socklen_t)(*fromlen); - jint result = os::recvfrom(fd, buf, (size_t)nBytes, (uint)flags, from, &socklen); - *fromlen = (int)socklen; - return result; -JVM_END - - -JVM_LEAF(jint, JVM_GetSockName(jint fd, struct sockaddr *him, int *len)) - JVMWrapper2("JVM_GetSockName (0x%x)", fd); - //%note jvm_r6 - socklen_t socklen = (socklen_t)(*len); - jint result = os::get_sock_name(fd, him, &socklen); - *len = (int)socklen; - return result; -JVM_END - - -JVM_LEAF(jint, JVM_SendTo(jint fd, char *buf, int len, int flags, struct sockaddr *to, int tolen)) - JVMWrapper2("JVM_SendTo (0x%x)", fd); - //%note jvm_r6 - return os::sendto(fd, buf, (size_t)len, (uint)flags, to, (socklen_t)tolen); -JVM_END - - -JVM_LEAF(jint, JVM_SocketAvailable(jint fd, jint *pbytes)) - JVMWrapper2("JVM_SocketAvailable (0x%x)", fd); - //%note jvm_r6 - return os::socket_available(fd, pbytes); -JVM_END - - -JVM_LEAF(jint, JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen)) - JVMWrapper2("JVM_GetSockOpt (0x%x)", fd); - //%note jvm_r6 - socklen_t socklen = (socklen_t)(*optlen); - jint result = os::get_sock_opt(fd, level, optname, optval, &socklen); - *optlen = (int)socklen; - return result; -JVM_END - - -JVM_LEAF(jint, JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen)) - JVMWrapper2("JVM_GetSockOpt (0x%x)", fd); - //%note jvm_r6 - return os::set_sock_opt(fd, level, optname, optval, (socklen_t)optlen); -JVM_END - - -JVM_LEAF(int, JVM_GetHostName(char* name, int namelen)) - JVMWrapper("JVM_GetHostName"); - return os::get_host_name(name, namelen); -JVM_END - - // Library support /////////////////////////////////////////////////////////////////////////// JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name)) @@ -3891,14 +3398,6 @@ JVM_END -// Floating point support //////////////////////////////////////////////////////////////////// - -JVM_LEAF(jboolean, JVM_IsNaN(jdouble a)) - JVMWrapper("JVM_IsNaN"); - return g_isnan(a); -JVM_END - - // JNI version /////////////////////////////////////////////////////////////////////////////// JVM_LEAF(jboolean, JVM_IsSupportedJNIVersion(jint version)) @@ -4024,20 +3523,6 @@ return VM_Version::supports_cx8(); JVM_END - -JVM_ENTRY(jboolean, JVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fid, jlong oldVal, jlong newVal)) - JVMWrapper("JVM_CX8Field"); - jlong res; - oop o = JNIHandles::resolve(obj); - intptr_t fldOffs = jfieldIDWorkaround::from_instance_jfieldID(o->klass(), fid); - volatile jlong* addr = (volatile jlong*)((address)o + fldOffs); - - assert(VM_Version::supports_cx8(), "cx8 not supported"); - res = Atomic::cmpxchg(newVal, addr, oldVal); - - return res == oldVal; -JVM_END - // DTrace /////////////////////////////////////////////////////////////////// JVM_ENTRY(jint, JVM_DTraceGetVersion(JNIEnv* env)) @@ -4192,189 +3677,6 @@ } JVM_END -JVM_ENTRY(jintArray, JVM_GetThreadStateValues(JNIEnv* env, - jint javaThreadState)) -{ - // If new thread states are added in future JDK and VM versions, - // this should check if the JDK version is compatible with thread - // states supported by the VM. Return NULL if not compatible. - // - // This function must map the VM java_lang_Thread::ThreadStatus - // to the Java thread state that the JDK supports. - // - - typeArrayHandle values_h; - switch (javaThreadState) { - case JAVA_THREAD_STATE_NEW : { - typeArrayOop r = oopFactory::new_typeArray(T_INT, 1, CHECK_NULL); - values_h = typeArrayHandle(THREAD, r); - values_h->int_at_put(0, java_lang_Thread::NEW); - break; - } - case JAVA_THREAD_STATE_RUNNABLE : { - typeArrayOop r = oopFactory::new_typeArray(T_INT, 1, CHECK_NULL); - values_h = typeArrayHandle(THREAD, r); - values_h->int_at_put(0, java_lang_Thread::RUNNABLE); - break; - } - case JAVA_THREAD_STATE_BLOCKED : { - typeArrayOop r = oopFactory::new_typeArray(T_INT, 1, CHECK_NULL); - values_h = typeArrayHandle(THREAD, r); - values_h->int_at_put(0, java_lang_Thread::BLOCKED_ON_MONITOR_ENTER); - break; - } - case JAVA_THREAD_STATE_WAITING : { - typeArrayOop r = oopFactory::new_typeArray(T_INT, 2, CHECK_NULL); - values_h = typeArrayHandle(THREAD, r); - values_h->int_at_put(0, java_lang_Thread::IN_OBJECT_WAIT); - values_h->int_at_put(1, java_lang_Thread::PARKED); - break; - } - case JAVA_THREAD_STATE_TIMED_WAITING : { - typeArrayOop r = oopFactory::new_typeArray(T_INT, 3, CHECK_NULL); - values_h = typeArrayHandle(THREAD, r); - values_h->int_at_put(0, java_lang_Thread::SLEEPING); - values_h->int_at_put(1, java_lang_Thread::IN_OBJECT_WAIT_TIMED); - values_h->int_at_put(2, java_lang_Thread::PARKED_TIMED); - break; - } - case JAVA_THREAD_STATE_TERMINATED : { - typeArrayOop r = oopFactory::new_typeArray(T_INT, 1, CHECK_NULL); - values_h = typeArrayHandle(THREAD, r); - values_h->int_at_put(0, java_lang_Thread::TERMINATED); - break; - } - default: - // Unknown state - probably incompatible JDK version - return NULL; - } - - return (jintArray) JNIHandles::make_local(env, values_h()); -} -JVM_END - - -JVM_ENTRY(jobjectArray, JVM_GetThreadStateNames(JNIEnv* env, - jint javaThreadState, - jintArray values)) -{ - // If new thread states are added in future JDK and VM versions, - // this should check if the JDK version is compatible with thread - // states supported by the VM. Return NULL if not compatible. - // - // This function must map the VM java_lang_Thread::ThreadStatus - // to the Java thread state that the JDK supports. - // - - ResourceMark rm; - - // Check if threads is null - if (values == NULL) { - THROW_(vmSymbols::java_lang_NullPointerException(), 0); - } - - typeArrayOop v = typeArrayOop(JNIHandles::resolve_non_null(values)); - typeArrayHandle values_h(THREAD, v); - - objArrayHandle names_h; - switch (javaThreadState) { - case JAVA_THREAD_STATE_NEW : { - assert(values_h->length() == 1 && - values_h->int_at(0) == java_lang_Thread::NEW, - "Invalid threadStatus value"); - - objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), - 1, /* only 1 substate */ - CHECK_NULL); - names_h = objArrayHandle(THREAD, r); - Handle name = java_lang_String::create_from_str("NEW", CHECK_NULL); - names_h->obj_at_put(0, name()); - break; - } - case JAVA_THREAD_STATE_RUNNABLE : { - assert(values_h->length() == 1 && - values_h->int_at(0) == java_lang_Thread::RUNNABLE, - "Invalid threadStatus value"); - - objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), - 1, /* only 1 substate */ - CHECK_NULL); - names_h = objArrayHandle(THREAD, r); - Handle name = java_lang_String::create_from_str("RUNNABLE", CHECK_NULL); - names_h->obj_at_put(0, name()); - break; - } - case JAVA_THREAD_STATE_BLOCKED : { - assert(values_h->length() == 1 && - values_h->int_at(0) == java_lang_Thread::BLOCKED_ON_MONITOR_ENTER, - "Invalid threadStatus value"); - - objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), - 1, /* only 1 substate */ - CHECK_NULL); - names_h = objArrayHandle(THREAD, r); - Handle name = java_lang_String::create_from_str("BLOCKED", CHECK_NULL); - names_h->obj_at_put(0, name()); - break; - } - case JAVA_THREAD_STATE_WAITING : { - assert(values_h->length() == 2 && - values_h->int_at(0) == java_lang_Thread::IN_OBJECT_WAIT && - values_h->int_at(1) == java_lang_Thread::PARKED, - "Invalid threadStatus value"); - objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), - 2, /* number of substates */ - CHECK_NULL); - names_h = objArrayHandle(THREAD, r); - Handle name0 = java_lang_String::create_from_str("WAITING.OBJECT_WAIT", - CHECK_NULL); - Handle name1 = java_lang_String::create_from_str("WAITING.PARKED", - CHECK_NULL); - names_h->obj_at_put(0, name0()); - names_h->obj_at_put(1, name1()); - break; - } - case JAVA_THREAD_STATE_TIMED_WAITING : { - assert(values_h->length() == 3 && - values_h->int_at(0) == java_lang_Thread::SLEEPING && - values_h->int_at(1) == java_lang_Thread::IN_OBJECT_WAIT_TIMED && - values_h->int_at(2) == java_lang_Thread::PARKED_TIMED, - "Invalid threadStatus value"); - objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), - 3, /* number of substates */ - CHECK_NULL); - names_h = objArrayHandle(THREAD, r); - Handle name0 = java_lang_String::create_from_str("TIMED_WAITING.SLEEPING", - CHECK_NULL); - Handle name1 = java_lang_String::create_from_str("TIMED_WAITING.OBJECT_WAIT", - CHECK_NULL); - Handle name2 = java_lang_String::create_from_str("TIMED_WAITING.PARKED", - CHECK_NULL); - names_h->obj_at_put(0, name0()); - names_h->obj_at_put(1, name1()); - names_h->obj_at_put(2, name2()); - break; - } - case JAVA_THREAD_STATE_TERMINATED : { - assert(values_h->length() == 1 && - values_h->int_at(0) == java_lang_Thread::TERMINATED, - "Invalid threadStatus value"); - objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), - 1, /* only 1 substate */ - CHECK_NULL); - names_h = objArrayHandle(THREAD, r); - Handle name = java_lang_String::create_from_str("TERMINATED", CHECK_NULL); - names_h->obj_at_put(0, name()); - break; - } - default: - // Unknown state - probably incompatible JDK version - return NULL; - } - return (jobjectArray) JNIHandles::make_local(env, names_h()); -} -JVM_END - JVM_ENTRY(void, JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size)) { memset(info, 0, info_size); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/prims/jvm.h --- a/hotspot/src/share/vm/prims/jvm.h Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/prims/jvm.h Thu Oct 23 13:44:59 2014 -0700 @@ -138,18 +138,6 @@ JNIEXPORT jobject JNICALL JVM_InitProperties(JNIEnv *env, jobject p); -/* - * java.io.File - */ -JNIEXPORT void JNICALL -JVM_OnExit(void (*func)(void)); - -/* - * java.lang.Runtime - */ -JNIEXPORT void JNICALL -JVM_Exit(jint code); - JNIEXPORT void JNICALL JVM_Halt(jint code); @@ -173,12 +161,6 @@ JNIEXPORT jlong JNICALL JVM_MaxObjectInspectionAge(void); -JNIEXPORT void JNICALL -JVM_TraceInstructions(jboolean on); - -JNIEXPORT void JNICALL -JVM_TraceMethodCalls(jboolean on); - JNIEXPORT jlong JNICALL JVM_TotalMemory(void); @@ -204,12 +186,6 @@ JVM_IsSupportedJNIVersion(jint version); /* - * java.lang.Float and java.lang.Double - */ -JNIEXPORT jboolean JNICALL -JVM_IsNaN(jdouble d); - -/* * java.lang.Throwable */ JNIEXPORT void JNICALL @@ -222,30 +198,6 @@ JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index); /* - * java.lang.Compiler - */ -JNIEXPORT void JNICALL -JVM_InitializeCompiler (JNIEnv *env, jclass compCls); - -JNIEXPORT jboolean JNICALL -JVM_IsSilentCompiler(JNIEnv *env, jclass compCls); - -JNIEXPORT jboolean JNICALL -JVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls); - -JNIEXPORT jboolean JNICALL -JVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname); - -JNIEXPORT jobject JNICALL -JVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg); - -JNIEXPORT void JNICALL -JVM_EnableCompiler(JNIEnv *env, jclass compCls); - -JNIEXPORT void JNICALL -JVM_DisableCompiler(JNIEnv *env, jclass compCls); - -/* * java.lang.Thread */ JNIEXPORT void JNICALL @@ -331,25 +283,9 @@ * java.io.ObjectInputStream */ JNIEXPORT jobject JNICALL -JVM_AllocateNewObject(JNIEnv *env, jobject obj, jclass currClass, - jclass initClass); - -JNIEXPORT jobject JNICALL -JVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass, - jint length); - -JNIEXPORT jobject JNICALL JVM_LatestUserDefinedLoader(JNIEnv *env); /* - * This function has been deprecated and should not be considered - * part of the specified JVM interface. - */ -JNIEXPORT jclass JNICALL -JVM_LoadClass0(JNIEnv *env, jobject obj, jclass currClass, - jstring currClassName); - -/* * java.lang.reflect.Array */ JNIEXPORT jint JNICALL @@ -399,12 +335,6 @@ JVM_FindPrimitiveClass(JNIEnv *env, const char *utf); /* - * Link the class - */ -JNIEXPORT void JNICALL -JVM_ResolveClass(JNIEnv *env, jclass cls); - -/* * Find a class from a given class loader. Throw ClassNotFoundException * or NoClassDefFoundError depending on the value of the last * argument. @@ -512,22 +442,6 @@ /* Annotations support (JDK 1.6) */ -// field is a handle to a java.lang.reflect.Field object -JNIEXPORT jbyteArray JNICALL -JVM_GetFieldAnnotations(JNIEnv *env, jobject field); - -// method is a handle to a java.lang.reflect.Method object -JNIEXPORT jbyteArray JNICALL -JVM_GetMethodAnnotations(JNIEnv *env, jobject method); - -// method is a handle to a java.lang.reflect.Method object -JNIEXPORT jbyteArray JNICALL -JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method); - -// method is a handle to a java.lang.reflect.Method object -JNIEXPORT jbyteArray JNICALL -JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method); - /* Type use annotations support (JDK 1.8) */ JNIEXPORT jbyteArray JNICALL @@ -660,9 +574,6 @@ JNIEXPORT jboolean JNICALL JVM_SupportsCX8(void); -JNIEXPORT jboolean JNICALL -JVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fldID, jlong oldVal, jlong newVal); - /* * com.sun.dtrace.jsdt support */ @@ -1243,43 +1154,6 @@ PART 3: I/O and Network Support ************************************************************************/ -/* Note that the JVM IO functions are expected to return JVM_IO_ERR - * when there is any kind of error. The caller can then use the - * platform specific support (e.g., errno) to get the detailed - * error info. The JVM_GetLastErrorString procedure may also be used - * to obtain a descriptive error string. - */ -#define JVM_IO_ERR (-1) - -/* For interruptible IO. Returning JVM_IO_INTR indicates that an IO - * operation has been disrupted by Thread.interrupt. There are a - * number of technical difficulties related to interruptible IO that - * need to be solved. For example, most existing programs do not handle - * InterruptedIOExceptions specially, they simply treat those as any - * IOExceptions, which typically indicate fatal errors. - * - * There are also two modes of operation for interruptible IO. In the - * resumption mode, an interrupted IO operation is guaranteed not to - * have any side-effects, and can be restarted. In the termination mode, - * an interrupted IO operation corrupts the underlying IO stream, so - * that the only reasonable operation on an interrupted stream is to - * close that stream. The resumption mode seems to be impossible to - * implement on Win32 and Solaris. Implementing the termination mode is - * easier, but it's not clear that's the right semantics. - * - * Interruptible IO is not supported on Win32.It can be enabled/disabled - * using a compile-time flag on Solaris. Third-party JVM ports do not - * need to implement interruptible IO. - */ -#define JVM_IO_INTR (-2) - -/* Write a string into the given buffer, in the platform's local encoding, - * that describes the most recent system-level error to occur in this thread. - * Return the length of the string or zero if no error occurred. - */ -JNIEXPORT jint JNICALL -JVM_GetLastErrorString(char *buf, int len); - /* * Convert a pathname into native format. This function does syntactic * cleanup, such as removing redundant separator characters. It modifies @@ -1289,150 +1163,6 @@ JVM_NativePath(char *); /* - * JVM I/O error codes - */ -#define JVM_EEXIST -100 - -/* - * Open a file descriptor. This function returns a negative error code - * on error, and a non-negative integer that is the file descriptor on - * success. - */ -JNIEXPORT jint JNICALL -JVM_Open(const char *fname, jint flags, jint mode); - -/* - * Close a file descriptor. This function returns -1 on error, and 0 - * on success. - * - * fd the file descriptor to close. - */ -JNIEXPORT jint JNICALL -JVM_Close(jint fd); - -/* - * Read data from a file decriptor into a char array. - * - * fd the file descriptor to read from. - * buf the buffer where to put the read data. - * nbytes the number of bytes to read. - * - * This function returns -1 on error, and 0 on success. - */ -JNIEXPORT jint JNICALL -JVM_Read(jint fd, char *buf, jint nbytes); - -/* - * Write data from a char array to a file decriptor. - * - * fd the file descriptor to read from. - * buf the buffer from which to fetch the data. - * nbytes the number of bytes to write. - * - * This function returns -1 on error, and 0 on success. - */ -JNIEXPORT jint JNICALL -JVM_Write(jint fd, char *buf, jint nbytes); - -/* - * Returns the number of bytes available for reading from a given file - * descriptor - */ -JNIEXPORT jint JNICALL -JVM_Available(jint fd, jlong *pbytes); - -/* - * Move the file descriptor pointer from whence by offset. - * - * fd the file descriptor to move. - * offset the number of bytes to move it by. - * whence the start from where to move it. - * - * This function returns the resulting pointer location. - */ -JNIEXPORT jlong JNICALL -JVM_Lseek(jint fd, jlong offset, jint whence); - -/* - * Set the length of the file associated with the given descriptor to the given - * length. If the new length is longer than the current length then the file - * is extended; the contents of the extended portion are not defined. The - * value of the file pointer is undefined after this procedure returns. - */ -JNIEXPORT jint JNICALL -JVM_SetLength(jint fd, jlong length); - -/* - * Synchronize the file descriptor's in memory state with that of the - * physical device. Return of -1 is an error, 0 is OK. - */ -JNIEXPORT jint JNICALL -JVM_Sync(jint fd); - -/* - * Networking library support - */ - -JNIEXPORT jint JNICALL -JVM_InitializeSocketLibrary(void); - -struct sockaddr; - -JNIEXPORT jint JNICALL -JVM_Socket(jint domain, jint type, jint protocol); - -JNIEXPORT jint JNICALL -JVM_SocketClose(jint fd); - -JNIEXPORT jint JNICALL -JVM_SocketShutdown(jint fd, jint howto); - -JNIEXPORT jint JNICALL -JVM_Recv(jint fd, char *buf, jint nBytes, jint flags); - -JNIEXPORT jint JNICALL -JVM_Send(jint fd, char *buf, jint nBytes, jint flags); - -JNIEXPORT jint JNICALL -JVM_Timeout(int fd, long timeout); - -JNIEXPORT jint JNICALL -JVM_Listen(jint fd, jint count); - -JNIEXPORT jint JNICALL -JVM_Connect(jint fd, struct sockaddr *him, jint len); - -JNIEXPORT jint JNICALL -JVM_Bind(jint fd, struct sockaddr *him, jint len); - -JNIEXPORT jint JNICALL -JVM_Accept(jint fd, struct sockaddr *him, jint *len); - -JNIEXPORT jint JNICALL -JVM_RecvFrom(jint fd, char *buf, int nBytes, - int flags, struct sockaddr *from, int *fromlen); - -JNIEXPORT jint JNICALL -JVM_SendTo(jint fd, char *buf, int len, - int flags, struct sockaddr *to, int tolen); - -JNIEXPORT jint JNICALL -JVM_SocketAvailable(jint fd, jint *result); - - -JNIEXPORT jint JNICALL -JVM_GetSockName(jint fd, struct sockaddr *him, int *len); - -JNIEXPORT jint JNICALL -JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen); - -JNIEXPORT jint JNICALL -JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen); - -JNIEXPORT int JNICALL -JVM_GetHostName(char* name, int namelen); - -/* * The standard printing functions supported by the Java VM. (Should they * be renamed to JVM_* in the future? */ @@ -1509,39 +1239,6 @@ JNIEXPORT jobjectArray JNICALL JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass); -/* - * Java thread state support - */ -enum { - JAVA_THREAD_STATE_NEW = 0, - JAVA_THREAD_STATE_RUNNABLE = 1, - JAVA_THREAD_STATE_BLOCKED = 2, - JAVA_THREAD_STATE_WAITING = 3, - JAVA_THREAD_STATE_TIMED_WAITING = 4, - JAVA_THREAD_STATE_TERMINATED = 5, - JAVA_THREAD_STATE_COUNT = 6 -}; - -/* - * Returns an array of the threadStatus values representing the - * given Java thread state. Returns NULL if the VM version is - * incompatible with the JDK or doesn't support the given - * Java thread state. - */ -JNIEXPORT jintArray JNICALL -JVM_GetThreadStateValues(JNIEnv* env, jint javaThreadState); - -/* - * Returns an array of the substate names representing the - * given Java thread state. Returns NULL if the VM version is - * incompatible with the JDK or the VM doesn't support - * the given Java thread state. - * values must be the jintArray returned from JVM_GetThreadStateValues - * and javaThreadState. - */ -JNIEXPORT jobjectArray JNICALL -JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values); - /* ========================================================================= * The following defines a private JVM interface that the JDK can query * for the JVM version and capabilities. sun.misc.Version defines diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/prims/jvmtiEnvBase.cpp --- a/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -1031,7 +1031,7 @@ // implied else: entry_count == 0 } - int nWant,nWait; + jint nWant, nWait; if (mon != NULL) { // this object has a heavyweight monitor nWant = mon->contentions(); // # of threads contending for monitor diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/prims/whitebox.cpp --- a/hotspot/src/share/vm/prims/whitebox.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/prims/whitebox.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -335,7 +335,36 @@ } WB_END +WB_ENTRY(jboolean, WB_NMTChangeTrackingLevel(JNIEnv* env)) + // Test that we can downgrade NMT levels but not upgrade them. + if (MemTracker::tracking_level() == NMT_off) { + MemTracker::transition_to(NMT_off); + return MemTracker::tracking_level() == NMT_off; + } else { + assert(MemTracker::tracking_level() == NMT_detail, "Should start out as detail tracking"); + MemTracker::transition_to(NMT_summary); + assert(MemTracker::tracking_level() == NMT_summary, "Should be summary now"); + // Can't go to detail once NMT is set to summary. + MemTracker::transition_to(NMT_detail); + assert(MemTracker::tracking_level() == NMT_summary, "Should still be summary now"); + + // Shutdown sets tracking level to minimal. + MemTracker::shutdown(); + assert(MemTracker::tracking_level() == NMT_minimal, "Should be minimal now"); + + // Once the tracking level is minimal, we cannot increase to summary. + // The code ignores this request instead of asserting because if the malloc site + // table overflows in another thread, it tries to change the code to summary. + MemTracker::transition_to(NMT_summary); + assert(MemTracker::tracking_level() == NMT_minimal, "Should still be minimal now"); + + // Really can never go up to detail, verify that the code would never do this. + MemTracker::transition_to(NMT_detail); + assert(MemTracker::tracking_level() == NMT_minimal, "Should still be minimal now"); + return MemTracker::tracking_level() == NMT_minimal; + } +WB_END #endif // INCLUDE_NMT static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) { @@ -962,6 +991,7 @@ {CC"NMTReleaseMemory", CC"(JJ)V", (void*)&WB_NMTReleaseMemory }, {CC"NMTOverflowHashBucket", CC"(J)V", (void*)&WB_NMTOverflowHashBucket}, {CC"NMTIsDetailSupported",CC"()Z", (void*)&WB_NMTIsDetailSupported}, + {CC"NMTChangeTrackingLevel", CC"()Z", (void*)&WB_NMTChangeTrackingLevel}, #endif // INCLUDE_NMT {CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll }, {CC"deoptimizeMethod", CC"(Ljava/lang/reflect/Executable;Z)I", diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -1135,6 +1135,21 @@ } #endif +// Returns threshold scaled with CompileThresholdScaling +intx Arguments::get_scaled_compile_threshold(intx threshold) { + return (intx)(threshold * CompileThresholdScaling); +} + +// Returns freq_log scaled with CompileThresholdScaling +intx Arguments::get_scaled_freq_log(intx freq_log) { + intx scaled_freq = get_scaled_compile_threshold((intx)1 << freq_log); + if (scaled_freq == 0) { + return 0; + } else { + return log2_intptr(scaled_freq); + } +} + void Arguments::set_tiered_flags() { // With tiered, set default policy to AdvancedThresholdPolicy, which is 3. if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { @@ -1174,6 +1189,32 @@ Tier3InvokeNotifyFreqLog = 0; Tier4InvocationThreshold = 0; } + // Scale tiered compilation thresholds + if (!FLAG_IS_DEFAULT(CompileThresholdScaling)) { + FLAG_SET_ERGO(intx, Tier0InvokeNotifyFreqLog, get_scaled_freq_log(Tier0InvokeNotifyFreqLog)); + FLAG_SET_ERGO(intx, Tier0BackedgeNotifyFreqLog, get_scaled_freq_log(Tier0BackedgeNotifyFreqLog)); + + FLAG_SET_ERGO(intx, Tier3InvocationThreshold, get_scaled_compile_threshold(Tier3InvocationThreshold)); + FLAG_SET_ERGO(intx, Tier3MinInvocationThreshold, get_scaled_compile_threshold(Tier3MinInvocationThreshold)); + FLAG_SET_ERGO(intx, Tier3CompileThreshold, get_scaled_compile_threshold(Tier3CompileThreshold)); + FLAG_SET_ERGO(intx, Tier3BackEdgeThreshold, get_scaled_compile_threshold(Tier3BackEdgeThreshold)); + + // Tier2{Invocation,MinInvocation,Compile,Backedge}Threshold should be scaled here + // once these thresholds become supported. + + FLAG_SET_ERGO(intx, Tier2InvokeNotifyFreqLog, get_scaled_freq_log(Tier2InvokeNotifyFreqLog)); + FLAG_SET_ERGO(intx, Tier2BackedgeNotifyFreqLog, get_scaled_freq_log(Tier2BackedgeNotifyFreqLog)); + + FLAG_SET_ERGO(intx, Tier3InvokeNotifyFreqLog, get_scaled_freq_log(Tier3InvokeNotifyFreqLog)); + FLAG_SET_ERGO(intx, Tier3BackedgeNotifyFreqLog, get_scaled_freq_log(Tier3BackedgeNotifyFreqLog)); + + FLAG_SET_ERGO(intx, Tier23InlineeNotifyFreqLog, get_scaled_freq_log(Tier23InlineeNotifyFreqLog)); + + FLAG_SET_ERGO(intx, Tier4InvocationThreshold, get_scaled_compile_threshold(Tier4InvocationThreshold)); + FLAG_SET_ERGO(intx, Tier4MinInvocationThreshold, get_scaled_compile_threshold(Tier4MinInvocationThreshold)); + FLAG_SET_ERGO(intx, Tier4CompileThreshold, get_scaled_compile_threshold(Tier4CompileThreshold)); + FLAG_SET_ERGO(intx, Tier4BackEdgeThreshold, get_scaled_compile_threshold(Tier4BackEdgeThreshold)); + } } /** @@ -3501,7 +3542,9 @@ // not specified. set_mode_flags(_int); } - if (CompileThreshold == 0) { + + if ((TieredCompilation && CompileThresholdScaling == 0) + || (!TieredCompilation && get_scaled_compile_threshold(CompileThreshold) == 0)) { set_mode_flags(_int); } @@ -3739,6 +3782,8 @@ bool settings_file_specified = false; bool needs_hotspotrc_warning = false; + ArgumentsExt::process_options(args); + const char* flags_file; int index; for (index = 0; index < args->nOptions; index++) { @@ -3926,7 +3971,20 @@ vm_exit_during_initialization( "Incompatible compilation policy selected", NULL); } + // Scale CompileThreshold + if (!FLAG_IS_DEFAULT(CompileThresholdScaling)) { + FLAG_SET_ERGO(intx, CompileThreshold, get_scaled_compile_threshold(CompileThreshold)); + } } + +#ifdef COMPILER2 +#ifndef PRODUCT + if (PrintIdealGraphLevel > 0) { + FLAG_SET_ERGO(bool, PrintIdealGraph, true); + } +#endif +#endif + // Set NmethodSweepFraction after the size of the code cache is adapted (in case of tiered) if (FLAG_IS_DEFAULT(NmethodSweepFraction)) { FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M)); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/arguments.hpp --- a/hotspot/src/share/vm/runtime/arguments.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/arguments.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -326,6 +326,9 @@ static bool _ClipInlining; static bool _CIDynamicCompilePriority; + // Scale compile thresholds + static intx get_scaled_compile_threshold(intx threshold); + static intx get_scaled_freq_log(intx freq_log); // Tiered static void set_tiered_flags(); static int get_min_number_of_compiler_threads(); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/arguments_ext.hpp --- a/hotspot/src/share/vm/runtime/arguments_ext.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/arguments_ext.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -34,6 +34,7 @@ static inline bool check_gc_consistency_user(); static inline bool check_gc_consistency_ergo(); static inline bool check_vm_args_consistency(); + static void process_options(const JavaVMInitArgs* args) {} }; void ArgumentsExt::select_gc_ergonomically() { diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/globals.cpp --- a/hotspot/src/share/vm/runtime/globals.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/globals.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -256,6 +256,11 @@ return is_unlocked_ext(); } +void Flag::unlock_diagnostic() { + assert(is_diagnostic(), "sanity"); + _flags = Flags(_flags & ~KIND_DIAGNOSTIC); +} + // Get custom message for this locked flag, or return NULL if // none is available. void Flag::get_locked_message(char* buf, int buflen) const { diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/globals.hpp --- a/hotspot/src/share/vm/runtime/globals.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/globals.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -320,6 +320,8 @@ bool is_writeable_ext() const; bool is_external_ext() const; + void unlock_diagnostic(); + void get_locked_message(char*, int) const; void get_locked_message_ext(char*, int) const; @@ -454,7 +456,7 @@ // notproduct flags are settable / visible only during development and are not declared in the PRODUCT version // A flag must be declared with one of the following types: -// bool, intx, uintx, ccstr. +// bool, intx, uintx, ccstr, double, or uint64_t. // The type "ccstr" is an alias for "const char*" and is used // only in this file, because the macrology requires single-token type names. @@ -1533,8 +1535,11 @@ product(bool, UseParNewGC, false, \ "Use parallel threads in the new generation") \ \ - product(bool, ParallelGCVerbose, false, \ - "Verbose output for parallel gc") \ + product(bool, PrintTaskqueue, false, \ + "Print taskqueue statistics for parallel collectors") \ + \ + product(bool, PrintTerminationStats, false, \ + "Print termination statistics for parallel collectors") \ \ product(uintx, ParallelGCBufferWastePct, 10, \ "Wasted fraction of parallel allocation buffer") \ @@ -3578,6 +3583,10 @@ product_pd(intx, CompileThreshold, \ "number of interpreted method invocations before (re-)compiling") \ \ + product(double, CompileThresholdScaling, 1.0, \ + "Factor to control when first compilation happens " \ + "(both with and without tiered compilation)") \ + \ product(intx, Tier0InvokeNotifyFreqLog, 7, \ "Interpreter (tier 0) invocation notification frequency") \ \ diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/java.cpp --- a/hotspot/src/share/vm/runtime/java.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/java.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -387,46 +387,6 @@ #endif - -// Helper class for registering on_exit calls through JVM_OnExit - -extern "C" { - typedef void (*__exit_proc)(void); -} - -class ExitProc : public CHeapObj { - private: - __exit_proc _proc; - // void (*_proc)(void); - ExitProc* _next; - public: - // ExitProc(void (*proc)(void)) { - ExitProc(__exit_proc proc) { - _proc = proc; - _next = NULL; - } - void evaluate() { _proc(); } - ExitProc* next() const { return _next; } - void set_next(ExitProc* next) { _next = next; } -}; - - -// Linked list of registered on_exit procedures - -static ExitProc* exit_procs = NULL; - - -extern "C" { - void register_on_exit_function(void (*func)(void)) { - ExitProc *entry = new ExitProc(func); - // Classic vm does not throw an exception in case the allocation failed, - if (entry != NULL) { - entry->set_next(exit_procs); - exit_procs = entry; - } - } -} - // Note: before_exit() can be executed only once, if more than one threads // are trying to shutdown the VM at the same time, only one thread // can run before_exit() and all other threads must wait. @@ -457,16 +417,6 @@ } } - // The only difference between this and Win32's _onexit procs is that - // this version is invoked before any threads get killed. - ExitProc* current = exit_procs; - while (current != NULL) { - ExitProc* next = current->next(); - current->evaluate(); - delete current; - current = next; - } - // Hang forever on exit if we're reporting an error. if (ShowMessageBoxOnError && is_error_reported()) { os::infinite_sleep(); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/java.hpp --- a/hotspot/src/share/vm/runtime/java.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/java.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -27,9 +27,6 @@ #include "runtime/os.hpp" -// Register function to be called by before_exit -extern "C" { void register_on_exit_function(void (*func)(void)) ;} - // Execute code before all handles are released and thread is killed; prologue to vm_exit extern void before_exit(JavaThread * thread); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/javaCalls.cpp --- a/hotspot/src/share/vm/runtime/javaCalls.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/javaCalls.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -173,22 +173,6 @@ return T_ILLEGAL; } -// ===== object constructor calls ===== - -void JavaCalls::call_default_constructor(JavaThread* thread, methodHandle method, Handle receiver, TRAPS) { - assert(method->name() == vmSymbols::object_initializer_name(), "Should only be called for default constructor"); - assert(method->signature() == vmSymbols::void_method_signature(), "Should only be called for default constructor"); - - InstanceKlass* ik = method->method_holder(); - if (ik->is_initialized() && ik->has_vanilla_constructor()) { - // safe to skip constructor call - } else { - static JavaValue result(T_VOID); - JavaCallArguments args(receiver); - call(&result, method, &args, CHECK); - } -} - // ============ Virtual calls ============ void JavaCalls::call_virtual(JavaValue* result, KlassHandle spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) { diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/javaCalls.hpp --- a/hotspot/src/share/vm/runtime/javaCalls.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/javaCalls.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -183,9 +183,6 @@ class JavaCalls: AllStatic { static void call_helper(JavaValue* result, methodHandle* method, JavaCallArguments* args, TRAPS); public: - // Optimized Constuctor call - static void call_default_constructor(JavaThread* thread, methodHandle method, Handle receiver, TRAPS); - // call_special // ------------ // The receiver must be first oop in argument list diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/objectMonitor.cpp --- a/hotspot/src/share/vm/runtime/objectMonitor.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -257,7 +257,6 @@ assert(_recursions == 0, "internal state error"); _owner = THREAD; _recursions = 1; - OwnerIsThread = 1; return true; } if (Atomic::cmpxchg_ptr (THREAD, &_owner, NULL) != NULL) { @@ -280,7 +279,6 @@ // Either ASSERT _recursions == 0 or explicitly set _recursions = 0. assert(_recursions == 0, "invariant"); assert(_owner == Self, "invariant"); - // CONSIDER: set or assert OwnerIsThread == 1 return; } @@ -296,7 +294,6 @@ // Commute owner from a thread-specific on-stack BasicLockObject address to // a full-fledged "Thread *". _owner = Self; - OwnerIsThread = 1; return; } @@ -328,7 +325,7 @@ // Prevent deflation at STW-time. See deflate_idle_monitors() and is_busy(). // Ensure the object-monitor relationship remains stable while there's contention. - Atomic::inc_ptr(&_count); + Atomic::inc(&_count); EventJavaMonitorEnter event; @@ -384,7 +381,7 @@ // acquire it. } - Atomic::dec_ptr(&_count); + Atomic::dec(&_count); assert(_count >= 0, "invariant"); Self->_Stalled = 0; @@ -440,7 +437,6 @@ // Either guarantee _recursions == 0 or set _recursions = 0. assert(_recursions == 0, "invariant"); assert(_owner == Self, "invariant"); - // CONSIDER: set or assert that OwnerIsThread == 1 return 1; } // The lock had been free momentarily, but we lost the race to the lock. @@ -922,7 +918,6 @@ assert(_recursions == 0, "invariant"); _owner = THREAD; _recursions = 0; - OwnerIsThread = 1; } else { // Apparent unbalanced locking ... // Naively we'd like to throw IllegalMonitorStateException. @@ -1346,7 +1341,6 @@ assert(_recursions == 0, "internal state error"); _owner = THREAD; // Convert from basiclock addr to Thread addr _recursions = 0; - OwnerIsThread = 1; } } @@ -1385,7 +1379,6 @@ if (THREAD->is_lock_owned((address) _owner)) { \ _owner = THREAD; /* Convert from basiclock addr to Thread addr */ \ _recursions = 0; \ - OwnerIsThread = 1; \ } else { \ TEVENT(Throw IMSX); \ THROW(vmSymbols::java_lang_IllegalMonitorStateException()); \ @@ -1906,8 +1899,8 @@ // a contending thread could enqueue itself on the cxq and then spin locally // on a thread-specific variable such as its ParkEvent._Event flag. // That's left as an exercise for the reader. Note that global spinning is -// not problematic on Niagara, as the L2$ serves the interconnect and has both -// low latency and massive bandwidth. +// not problematic on Niagara, as the L2 cache serves the interconnect and +// has both low latency and massive bandwidth. // // Broadly, we can fix the spin frequency -- that is, the % of contended lock // acquisition attempts where we opt to spin -- at 100% and vary the spin count @@ -2208,7 +2201,7 @@ // as advisory. // // Beware too, that _owner is sometimes a BasicLock address and sometimes -// a thread pointer. We differentiate the two cases with OwnerIsThread. +// a thread pointer. // Alternately, we might tag the type (thread pointer vs basiclock pointer) // with the LSB of _owner. Another option would be to probablistically probe // the putative _owner->TypeTag value. @@ -2230,9 +2223,7 @@ int ObjectMonitor::NotRunnable(Thread * Self, Thread * ox) { - // Check either OwnerIsThread or ox->TypeTag == 2BAD. - if (!OwnerIsThread) return 0; - + // Check ox->TypeTag == 2BAD. if (ox == NULL) return 0; // Avoid transitive spinning ... @@ -2399,20 +2390,6 @@ } } - -// Compile-time asserts -// When possible, it's better to catch errors deterministically at -// compile-time than at runtime. The down-side to using compile-time -// asserts is that error message -- often something about negative array -// indices -- is opaque. - -#define CTASSERT(x) { int tag[1-(2*!(x))]; printf ("Tag @" INTPTR_FORMAT "\n", (intptr_t)tag); } - -void ObjectMonitor::ctAsserts() { - CTASSERT(offset_of (ObjectMonitor, _header) == 0); -} - - static char * kvGet(char * kvList, const char * Key) { if (kvList == NULL) return NULL; size_t n = strlen(Key); @@ -2526,6 +2503,8 @@ if (verbose) { tty->print_cr("INFO: sizeof(ObjectMonitor)=" SIZE_FORMAT, sizeof(ObjectMonitor)); + tty->print_cr("INFO: sizeof(PaddedEnd)=" SIZE_FORMAT, + sizeof(PaddedEnd)); } uint cache_line_size = VM_Version::L1_data_cache_line_size(); @@ -2559,9 +2538,9 @@ warning_cnt++; } - if ((sizeof(ObjectMonitor) % cache_line_size) != 0) { - tty->print_cr("WARNING: ObjectMonitor size is not a multiple of " - "a cache line which permits false sharing."); + if ((sizeof(PaddedEnd) % cache_line_size) != 0) { + tty->print_cr("WARNING: PaddedEnd size is not a " + "multiple of a cache line which permits false sharing."); warning_cnt++; } } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/objectMonitor.hpp --- a/hotspot/src/share/vm/runtime/objectMonitor.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/objectMonitor.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -25,6 +25,7 @@ #ifndef SHARE_VM_RUNTIME_OBJECTMONITOR_HPP #define SHARE_VM_RUNTIME_OBJECTMONITOR_HPP +#include "memory/padded.hpp" #include "runtime/os.hpp" #include "runtime/park.hpp" #include "runtime/perfData.hpp" @@ -58,21 +59,71 @@ // forward declaration to avoid include tracing.hpp class EventJavaMonitorWait; -// WARNING: -// This is a very sensitive and fragile class. DO NOT make any -// change unless you are fully aware of the underlying semantics. - -// This class can not inherit from any other class, because I have -// to let the displaced header be the very first word. Otherwise I -// have to let markOop include this file, which would export the -// monitor data structure to everywhere. +// The ObjectMonitor class implements the heavyweight version of a +// JavaMonitor. The lightweight BasicLock/stack lock version has been +// inflated into an ObjectMonitor. This inflation is typically due to +// contention or use of Object.wait(). +// +// WARNING: This is a very sensitive and fragile class. DO NOT make any +// changes unless you are fully aware of the underlying semantics. +// +// Class JvmtiRawMonitor currently inherits from ObjectMonitor so +// changes in this class must be careful to not break JvmtiRawMonitor. +// These two subsystems should be separated. +// +// ObjectMonitor Layout Overview/Highlights/Restrictions: // -// The ObjectMonitor class is used to implement JavaMonitors which have -// transformed from the lightweight structure of the thread stack to a -// heavy weight lock due to contention - -// It is also used as RawMonitor by the JVMTI - +// - The _header field must be at offset 0 because the displaced header +// from markOop is stored there. We do not want markOop.hpp to include +// ObjectMonitor.hpp to avoid exposing ObjectMonitor everywhere. This +// means that ObjectMonitor cannot inherit from any other class nor can +// it use any virtual member functions. This restriction is critical to +// the proper functioning of the VM. +// - The _header and _owner fields should be separated by enough space +// to avoid false sharing due to parallel access by different threads. +// This is an advisory recommendation. +// - The general layout of the fields in ObjectMonitor is: +// _header +// +// +// _owner +// +// - The VM assumes write ordering and machine word alignment with +// respect to the _owner field and the that can +// be read in parallel by other threads. +// - Generally fields that are accessed closely together in time should +// be placed proximally in space to promote data cache locality. That +// is, temporal locality should condition spatial locality. +// - We have to balance avoiding false sharing with excessive invalidation +// from coherence traffic. As such, we try to cluster fields that tend +// to be _written_ at approximately the same time onto the same data +// cache line. +// - We also have to balance the natural tension between minimizing +// single threaded capacity misses with excessive multi-threaded +// coherency misses. There is no single optimal layout for both +// single-threaded and multi-threaded environments. +// +// - See ObjectMonitor::sanity_checks() for how critical restrictions are +// enforced and advisory recommendations are reported. +// - Adjacent ObjectMonitors should be separated by enough space to avoid +// false sharing. This is handled by the ObjectMonitor allocation code +// in synchronizer.cpp. Also see ObjectSynchronizer::sanity_checks(). +// +// Futures notes: +// - Separating _owner from the by enough space to +// avoid false sharing might be profitable. Given +// http://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate +// we know that the CAS in monitorenter will invalidate the line +// underlying _owner. We want to avoid an L1 data cache miss on that +// same line for monitorexit. Putting these : +// _recursions, _EntryList, _cxq, and _succ, all of which may be +// fetched in the inflated unlock path, on a different cache line +// would make them immune to CAS-based invalidation from the _owner +// field. +// +// - The _recursions field should be of type int, or int32_t but not +// intptr_t. There's no reason to use a 64-bit type for this field +// in a 64-bit JVM. class ObjectMonitor { public: @@ -84,7 +135,84 @@ OM_TIMED_OUT // Object.wait() timed out }; + private: + friend class ObjectSynchronizer; + friend class ObjectWaiter; + friend class VMStructs; + + volatile markOop _header; // displaced object header word - mark + void* volatile _object; // backward object pointer - strong root public: + ObjectMonitor * FreeNext; // Free list linkage + private: + DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, + sizeof(volatile markOop) + sizeof(void * volatile) + + sizeof(ObjectMonitor *)); + protected: // protected for JvmtiRawMonitor + void * volatile _owner; // pointer to owning thread OR BasicLock + volatile jlong _previous_owner_tid; // thread id of the previous owner of the monitor + volatile intptr_t _recursions; // recursion count, 0 for first entry + ObjectWaiter * volatile _EntryList; // Threads blocked on entry or reentry. + // The list is actually composed of WaitNodes, + // acting as proxies for Threads. + private: + ObjectWaiter * volatile _cxq; // LL of recently-arrived threads blocked on entry. + Thread * volatile _succ; // Heir presumptive thread - used for futile wakeup throttling + Thread * volatile _Responsible; + + volatile int _Spinner; // for exit->spinner handoff optimization + volatile int _SpinFreq; // Spin 1-out-of-N attempts: success rate + volatile int _SpinClock; + volatile intptr_t _SpinState; // MCS/CLH list of spinners + volatile int _SpinDuration; + + volatile jint _count; // reference count to prevent reclamation/deflation + // at stop-the-world time. See deflate_idle_monitors(). + // _count is approximately |_WaitSet| + |_EntryList| + protected: + ObjectWaiter * volatile _WaitSet; // LL of threads wait()ing on the monitor + volatile jint _waiters; // number of waiting threads + private: + volatile int _WaitSetLock; // protects Wait Queue - simple spinlock + + public: + static void Initialize(); + static PerfCounter * _sync_ContendedLockAttempts; + static PerfCounter * _sync_FutileWakeups; + static PerfCounter * _sync_Parks; + static PerfCounter * _sync_EmptyNotifications; + static PerfCounter * _sync_Notifications; + static PerfCounter * _sync_SlowEnter; + static PerfCounter * _sync_SlowExit; + static PerfCounter * _sync_SlowNotify; + static PerfCounter * _sync_SlowNotifyAll; + static PerfCounter * _sync_FailedSpins; + static PerfCounter * _sync_SuccessfulSpins; + static PerfCounter * _sync_PrivateA; + static PerfCounter * _sync_PrivateB; + static PerfCounter * _sync_MonInCirculation; + static PerfCounter * _sync_MonScavenged; + static PerfCounter * _sync_Inflations; + static PerfCounter * _sync_Deflations; + static PerfLongVariable * _sync_MonExtant; + + static int Knob_Verbose; + static int Knob_VerifyInUse; + static int Knob_SpinLimit; + + void* operator new (size_t size) throw() { + return AllocateHeap(size, mtInternal); + } + void* operator new[] (size_t size) throw() { + return operator new (size); + } + void operator delete(void* p) { + FreeHeap(p, mtInternal); + } + void operator delete[] (void *p) { + operator delete(p); + } + // TODO-FIXME: the "offset" routines should return a type of off_t instead of int ... // ByteSize would also be an appropriate type. static int header_offset_in_bytes() { return offset_of(ObjectMonitor, _header); } @@ -100,14 +228,11 @@ static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible); } static int Spinner_offset_in_bytes() { return offset_of(ObjectMonitor, _Spinner); } - public: // Eventually we'll make provisions for multiple callbacks, but // now one will suffice. static int (*SpinCallbackFunction)(intptr_t, int); static intptr_t SpinCallbackArgument; - - public: markOop header() const; void set_header(markOop hdr); @@ -123,39 +248,22 @@ void* owner() const; void set_owner(void* owner); - intptr_t waiters() const; + jint waiters() const; - intptr_t count() const; - void set_count(intptr_t count); - intptr_t contentions() const; + jint count() const; + void set_count(jint count); + jint contentions() const; intptr_t recursions() const { return _recursions; } - // JVM/DI GetMonitorInfo() needs this + // JVM/TI GetObjectMonitorUsage() needs this: ObjectWaiter* first_waiter() { return _WaitSet; } ObjectWaiter* next_waiter(ObjectWaiter* o) { return o->_next; } Thread* thread_of_waiter(ObjectWaiter* o) { return o->_thread; } - // initialize the monitor, exception the semaphore, all other fields - // are simple integers or pointers - ObjectMonitor() { - _header = NULL; - _count = 0; - _waiters = 0; - _recursions = 0; - _object = NULL; - _owner = NULL; - _WaitSet = NULL; - _WaitSetLock = 0; - _Responsible = NULL; - _succ = NULL; - _cxq = NULL; - FreeNext = NULL; - _EntryList = NULL; - _SpinFreq = 0; - _SpinClock = 0; - OwnerIsThread = 0; - _previous_owner_tid = 0; - } + protected: + // We don't typically expect or want the ctors or dtors to run. + // normal ObjectMonitors are type-stable and immortal. + ObjectMonitor() { ::memset((void *)this, 0, sizeof(*this)); } ~ObjectMonitor() { // TODO: Add asserts ... @@ -169,7 +277,7 @@ // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0 // _count == 0 EntryList == NULL // _recursions == 0 _WaitSet == NULL - // TODO: assert (is_busy()|_recursions) == 0 + assert(((is_busy()|_recursions) == 0), "freeing inuse monitor"); _succ = NULL; _EntryList = NULL; _cxq = NULL; @@ -177,7 +285,6 @@ _recursions = 0; _SpinFreq = 0; _SpinClock = 0; - OwnerIsThread = 0; } public: @@ -221,7 +328,6 @@ int TrySpin_Fixed(Thread * Self); int TrySpin_VaryFrequency(Thread * Self); int TrySpin_VaryDuration(Thread * Self); - void ctAsserts(); void ExitEpilog(Thread * Self, ObjectWaiter * Wakee); bool ExitSuspendEquivalent(JavaThread * Self); void post_monitor_wait_event(EventJavaMonitorWait * event, @@ -229,102 +335,6 @@ jlong timeout, bool timedout); - private: - friend class ObjectSynchronizer; - friend class ObjectWaiter; - friend class VMStructs; - - // WARNING: this must be the very first word of ObjectMonitor - // This means this class can't use any virtual member functions. - - volatile markOop _header; // displaced object header word - mark - void* volatile _object; // backward object pointer - strong root - - double SharingPad[1]; // temp to reduce false sharing - - // All the following fields must be machine word aligned - // The VM assumes write ordering wrt these fields, which can be - // read from other threads. - - protected: // protected for jvmtiRawMonitor - void * volatile _owner; // pointer to owning thread OR BasicLock - volatile jlong _previous_owner_tid; // thread id of the previous owner of the monitor - volatile intptr_t _recursions; // recursion count, 0 for first entry - private: - int OwnerIsThread; // _owner is (Thread *) vs SP/BasicLock - ObjectWaiter * volatile _cxq; // LL of recently-arrived threads blocked on entry. - // The list is actually composed of WaitNodes, acting - // as proxies for Threads. - protected: - ObjectWaiter * volatile _EntryList; // Threads blocked on entry or reentry. - private: - Thread * volatile _succ; // Heir presumptive thread - used for futile wakeup throttling - Thread * volatile _Responsible; - int _PromptDrain; // rqst to drain cxq into EntryList ASAP - - volatile int _Spinner; // for exit->spinner handoff optimization - volatile int _SpinFreq; // Spin 1-out-of-N attempts: success rate - volatile int _SpinClock; - volatile int _SpinDuration; - volatile intptr_t _SpinState; // MCS/CLH list of spinners - - // TODO-FIXME: _count, _waiters and _recursions should be of - // type int, or int32_t but not intptr_t. There's no reason - // to use 64-bit fields for these variables on a 64-bit JVM. - - volatile intptr_t _count; // reference count to prevent reclamation/deflation - // at stop-the-world time. See deflate_idle_monitors(). - // _count is approximately |_WaitSet| + |_EntryList| - protected: - volatile intptr_t _waiters; // number of waiting threads - private: - protected: - ObjectWaiter * volatile _WaitSet; // LL of threads wait()ing on the monitor - private: - volatile int _WaitSetLock; // protects Wait Queue - simple spinlock - - public: - int _QMix; // Mixed prepend queue discipline - ObjectMonitor * FreeNext; // Free list linkage - intptr_t StatA, StatsB; - - public: - static void Initialize(); - static PerfCounter * _sync_ContendedLockAttempts; - static PerfCounter * _sync_FutileWakeups; - static PerfCounter * _sync_Parks; - static PerfCounter * _sync_EmptyNotifications; - static PerfCounter * _sync_Notifications; - static PerfCounter * _sync_SlowEnter; - static PerfCounter * _sync_SlowExit; - static PerfCounter * _sync_SlowNotify; - static PerfCounter * _sync_SlowNotifyAll; - static PerfCounter * _sync_FailedSpins; - static PerfCounter * _sync_SuccessfulSpins; - static PerfCounter * _sync_PrivateA; - static PerfCounter * _sync_PrivateB; - static PerfCounter * _sync_MonInCirculation; - static PerfCounter * _sync_MonScavenged; - static PerfCounter * _sync_Inflations; - static PerfCounter * _sync_Deflations; - static PerfLongVariable * _sync_MonExtant; - - public: - static int Knob_Verbose; - static int Knob_VerifyInUse; - static int Knob_SpinLimit; - void* operator new (size_t size) throw() { - return AllocateHeap(size, mtInternal); - } - void* operator new[] (size_t size) throw() { - return operator new (size); - } - void operator delete(void* p) { - FreeHeap(p, mtInternal); - } - void operator delete[] (void *p) { - operator delete(p); - } }; #undef TEVENT diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/objectMonitor.inline.hpp --- a/hotspot/src/share/vm/runtime/objectMonitor.inline.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/objectMonitor.inline.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -40,15 +40,11 @@ _header = hdr; } -inline intptr_t ObjectMonitor::count() const { +inline jint ObjectMonitor::count() const { return _count; } -inline void ObjectMonitor::set_count(intptr_t count) { - _count= count; -} - -inline intptr_t ObjectMonitor::waiters() const { +inline jint ObjectMonitor::waiters() const { return _waiters; } @@ -61,7 +57,7 @@ assert(_count == 0, "Fatal logic error in ObjectMonitor count!"); assert(_waiters == 0, "Fatal logic error in ObjectMonitor waiters!"); assert(_recursions == 0, "Fatal logic error in ObjectMonitor recursions!"); - assert(_object, "Fatal logic error in ObjectMonitor object!"); + assert(_object != NULL, "Fatal logic error in ObjectMonitor object!"); assert(_owner == 0, "Fatal logic error in ObjectMonitor owner!"); _header = NULL; @@ -85,7 +81,6 @@ if (THREAD != _owner) { if (THREAD->is_lock_owned((address) _owner)) { _owner = THREAD; // regain ownership of inflated monitor - OwnerIsThread = 1 ; assert (_recursions == 0, "invariant") ; } else { check_slow(THREAD); @@ -97,7 +92,7 @@ // return number of threads contending for this monitor -inline intptr_t ObjectMonitor::contentions() const { +inline jint ObjectMonitor::contentions() const { return _count; } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp --- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -30,11 +30,11 @@ switch(level) { case CompLevel_none: case CompLevel_limited_profile: - return (i > Tier3InvocationThreshold * scale) || - (i > Tier3MinInvocationThreshold * scale && i + b > Tier3CompileThreshold * scale); + return (i >= Tier3InvocationThreshold * scale) || + (i >= Tier3MinInvocationThreshold * scale && i + b >= Tier3CompileThreshold * scale); case CompLevel_full_profile: - return (i > Tier4InvocationThreshold * scale) || - (i > Tier4MinInvocationThreshold * scale && i + b > Tier4CompileThreshold * scale); + return (i >= Tier4InvocationThreshold * scale) || + (i >= Tier4MinInvocationThreshold * scale && i + b >= Tier4CompileThreshold * scale); } return true; } @@ -44,9 +44,9 @@ switch(level) { case CompLevel_none: case CompLevel_limited_profile: - return b > Tier3BackEdgeThreshold * scale; + return b >= Tier3BackEdgeThreshold * scale; case CompLevel_full_profile: - return b > Tier4BackEdgeThreshold * scale; + return b >= Tier4BackEdgeThreshold * scale; } return true; } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/synchronizer.cpp --- a/hotspot/src/share/vm/runtime/synchronizer.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/synchronizer.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "classfile/vmSymbols.hpp" +#include "memory/padded.hpp" #include "memory/resourceArea.hpp" #include "oops/markOop.hpp" #include "oops/oop.inline.hpp" @@ -110,6 +111,8 @@ #define NINFLATIONLOCKS 256 static volatile intptr_t InflationLocks[NINFLATIONLOCKS]; +// gBlockList is really PaddedEnd *, but we don't +// want to expose the PaddedEnd template more than necessary. ObjectMonitor * ObjectSynchronizer::gBlockList = NULL; ObjectMonitor * volatile ObjectSynchronizer::gFreeList = NULL; ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList = NULL; @@ -410,16 +413,15 @@ // performed by the CPU(s) or platform. struct SharedGlobals { + char _pad_prefix[DEFAULT_CACHE_LINE_SIZE]; // These are highly shared mostly-read variables. - // To avoid false-sharing they need to be the sole occupants of a $ line. - double padPrefix[8]; + // To avoid false-sharing they need to be the sole occupants of a cache line. volatile int stwRandom; volatile int stwCycle; - - // Hot RW variables -- Sequester to avoid false-sharing - double padSuffix[16]; + DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile int) * 2); + // Hot RW variable -- Sequester to avoid false-sharing volatile int hcSequence; - double padFinal[8]; + DEFINE_PAD_MINUS_SIZE(2, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile int)); }; static SharedGlobals GVars; @@ -780,18 +782,18 @@ // Visitors ... void ObjectSynchronizer::monitors_iterate(MonitorClosure* closure) { - ObjectMonitor* block = gBlockList; + PaddedEnd * block = (PaddedEnd *)gBlockList; ObjectMonitor* mid; while (block) { assert(block->object() == CHAINMARKER, "must be a block header"); for (int i = _BLOCKSIZE - 1; i > 0; i--) { - mid = block + i; + mid = (ObjectMonitor *)(block + i); oop object = (oop) mid->object(); if (object != NULL) { closure->do_monitor(mid); } } - block = (ObjectMonitor*) block->FreeNext; + block = (PaddedEnd *) block->FreeNext; } } @@ -806,10 +808,12 @@ void ObjectSynchronizer::oops_do(OopClosure* f) { assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); - for (ObjectMonitor* block = gBlockList; block != NULL; block = next(block)) { + for (PaddedEnd * block = + (PaddedEnd *)gBlockList; block != NULL; + block = (PaddedEnd *)next(block)) { assert(block->object() == CHAINMARKER, "must be a block header"); for (int i = 1; i < _BLOCKSIZE; i++) { - ObjectMonitor* mid = &block[i]; + ObjectMonitor* mid = (ObjectMonitor *)&block[i]; if (mid->object() != NULL) { f->do_oop((oop*)mid->object_addr()); } @@ -966,16 +970,29 @@ // 3: allocate a block of new ObjectMonitors // Both the local and global free lists are empty -- resort to malloc(). // In the current implementation objectMonitors are TSM - immortal. + // Ideally, we'd write "new ObjectMonitor[_BLOCKSIZE], but we want + // each ObjectMonitor to start at the beginning of a cache line, + // so we use align_size_up(). + // A better solution would be to use C++ placement-new. + // BEWARE: As it stands currently, we don't run the ctors! assert(_BLOCKSIZE > 1, "invariant"); - ObjectMonitor * temp = new ObjectMonitor[_BLOCKSIZE]; + size_t neededsize = sizeof(PaddedEnd) * _BLOCKSIZE; + PaddedEnd * temp; + size_t aligned_size = neededsize + (DEFAULT_CACHE_LINE_SIZE - 1); + void* real_malloc_addr = (void *)NEW_C_HEAP_ARRAY(char, aligned_size, + mtInternal); + temp = (PaddedEnd *) + align_size_up((intptr_t)real_malloc_addr, + DEFAULT_CACHE_LINE_SIZE); // NOTE: (almost) no way to recover if allocation failed. // We might be able to induce a STW safepoint and scavenge enough // objectMonitors to permit progress. if (temp == NULL) { - vm_exit_out_of_memory(sizeof (ObjectMonitor[_BLOCKSIZE]), OOM_MALLOC_ERROR, + vm_exit_out_of_memory(neededsize, OOM_MALLOC_ERROR, "Allocate ObjectMonitors"); } + (void)memset((void *) temp, 0, neededsize); // Format the block. // initialize the linked list, each monitor points to its next @@ -986,7 +1003,7 @@ // look like: class Block { Block * next; int N; ObjectMonitor Body [N] ; } for (int i = 1; i < _BLOCKSIZE; i++) { - temp[i].FreeNext = &temp[i+1]; + temp[i].FreeNext = (ObjectMonitor *)&temp[i+1]; } // terminate the last monitor as the end of list @@ -1141,10 +1158,6 @@ } -// Note that we could encounter some performance loss through false-sharing as -// multiple locks occupy the same $ line. Padding might be appropriate. - - ObjectMonitor * NOINLINE ObjectSynchronizer::inflate(Thread * Self, oop object) { // Inflate mutates the heap ... @@ -1210,7 +1223,6 @@ // in which INFLATING appears in the mark. m->Recycle(); m->_Responsible = NULL; - m->OwnerIsThread = 0; m->_recursions = 0; m->_SpinDuration = ObjectMonitor::Knob_SpinLimit; // Consider: maintain by type/class @@ -1257,8 +1269,8 @@ m->set_header(dmw); // Optimization: if the mark->locker stack address is associated - // with this thread we could simply set m->_owner = Self and - // m->OwnerIsThread = 1. Note that a thread can inflate an object + // with this thread we could simply set m->_owner = Self. + // Note that a thread can inflate an object // that it has stack-locked -- as might happen in wait() -- directly // with CAS. That is, we can avoid the xchg-NULL .... ST idiom. m->set_owner(mark->locker()); @@ -1302,7 +1314,6 @@ m->set_header(mark); m->set_owner(NULL); m->set_object(object); - m->OwnerIsThread = 1; m->_recursions = 0; m->_Responsible = NULL; m->_SpinDuration = ObjectMonitor::Knob_SpinLimit; // consider: keep metastats by type/class @@ -1310,7 +1321,6 @@ if (Atomic::cmpxchg_ptr (markOopDesc::encode(m), object->mark_addr(), mark) != mark) { m->set_object(NULL); m->set_owner(NULL); - m->OwnerIsThread = 0; m->Recycle(); omRelease(Self, m, true); m = NULL; @@ -1336,9 +1346,6 @@ } } -// Note that we could encounter some performance loss through false-sharing as -// multiple locks occupy the same $ line. Padding might be appropriate. - // Deflate_idle_monitors() is called at all safepoints, immediately // after all mutators are stopped, but before any objects have moved. @@ -1491,12 +1498,14 @@ nInuse += gOmInUseCount; } - } else for (ObjectMonitor* block = gBlockList; block != NULL; block = next(block)) { + } else for (PaddedEnd * block = + (PaddedEnd *)gBlockList; block != NULL; + block = (PaddedEnd *)next(block)) { // Iterate over all extant monitors - Scavenge all idle monitors. assert(block->object() == CHAINMARKER, "must be a block header"); nInCirculation += _BLOCKSIZE; for (int i = 1; i < _BLOCKSIZE; i++) { - ObjectMonitor* mid = &block[i]; + ObjectMonitor* mid = (ObjectMonitor*)&block[i]; oop obj = (oop) mid->object(); if (obj == NULL) { @@ -1648,18 +1657,18 @@ // Verify all monitors in the monitor cache, the verification is weak. void ObjectSynchronizer::verify() { - ObjectMonitor* block = gBlockList; + PaddedEnd * block = (PaddedEnd *)gBlockList; ObjectMonitor* mid; while (block) { assert(block->object() == CHAINMARKER, "must be a block header"); for (int i = 1; i < _BLOCKSIZE; i++) { - mid = block + i; + mid = (ObjectMonitor *)(block + i); oop object = (oop) mid->object(); if (object != NULL) { mid->verify(); } } - block = (ObjectMonitor*) block->FreeNext; + block = (PaddedEnd *) block->FreeNext; } } @@ -1668,18 +1677,19 @@ // the list of extant blocks without taking a lock. int ObjectSynchronizer::verify_objmon_isinpool(ObjectMonitor *monitor) { - ObjectMonitor* block = gBlockList; + PaddedEnd * block = (PaddedEnd *)gBlockList; while (block) { assert(block->object() == CHAINMARKER, "must be a block header"); - if (monitor > &block[0] && monitor < &block[_BLOCKSIZE]) { + if (monitor > (ObjectMonitor *)&block[0] && + monitor < (ObjectMonitor *)&block[_BLOCKSIZE]) { address mon = (address) monitor; address blk = (address) block; size_t diff = mon - blk; - assert((diff % sizeof(ObjectMonitor)) == 0, "check"); + assert((diff % sizeof(PaddedEnd)) == 0, "check"); return 1; } - block = (ObjectMonitor*) block->FreeNext; + block = (PaddedEnd *) block->FreeNext; } return 0; } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/synchronizer.hpp --- a/hotspot/src/share/vm/runtime/synchronizer.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/synchronizer.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -134,6 +134,8 @@ private: enum { _BLOCKSIZE = 128 }; + // gBlockList is really PaddedEnd *, but we don't + // want to expose the PaddedEnd template more than necessary. static ObjectMonitor* gBlockList; static ObjectMonitor * volatile gFreeList; // global monitor in use list, for moribund threads, diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/thread.cpp --- a/hotspot/src/share/vm/runtime/thread.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/thread.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -1287,6 +1287,7 @@ this->record_stack_base_and_size(); this->initialize_thread_local_storage(); + this->set_native_thread_name(this->name()); this->set_active_handles(JNIHandleBlock::allocate_block()); while (!_should_terminate) { assert(watcher_thread() == Thread::current(), "thread consistency check"); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/vmStructs.cpp --- a/hotspot/src/share/vm/runtime/vmStructs.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -1070,8 +1070,8 @@ volatile_nonstatic_field(ObjectMonitor, _header, markOop) \ unchecked_nonstatic_field(ObjectMonitor, _object, sizeof(void *)) /* NOTE: no type */ \ unchecked_nonstatic_field(ObjectMonitor, _owner, sizeof(void *)) /* NOTE: no type */ \ - volatile_nonstatic_field(ObjectMonitor, _count, intptr_t) \ - volatile_nonstatic_field(ObjectMonitor, _waiters, intptr_t) \ + volatile_nonstatic_field(ObjectMonitor, _count, jint) \ + volatile_nonstatic_field(ObjectMonitor, _waiters, jint) \ volatile_nonstatic_field(ObjectMonitor, _recursions, intptr_t) \ nonstatic_field(ObjectMonitor, FreeNext, ObjectMonitor*) \ volatile_nonstatic_field(BasicLock, _displaced_header, markOop) \ @@ -2507,6 +2507,12 @@ declare_constant(Deoptimization::Action_make_not_compilable) \ declare_constant(Deoptimization::Action_LIMIT) \ \ + /***************************************************/ \ + /* DEFAULT_CACHE_LINE_SIZE (globalDefinitions.hpp) */ \ + /***************************************************/ \ + \ + declare_constant(DEFAULT_CACHE_LINE_SIZE) \ + \ /*********************/ \ /* Matcher (C2 only) */ \ /*********************/ \ diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/runtime/vmThread.cpp --- a/hotspot/src/share/vm/runtime/vmThread.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/runtime/vmThread.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -241,6 +241,7 @@ assert(this == vm_thread(), "check"); this->initialize_thread_local_storage(); + this->set_native_thread_name(this->name()); this->record_stack_base_and_size(); // Notify_lock wait checks on active_handles() to rewait in // case of spurious wakeup, it should wait on the last diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/services/mallocTracker.cpp --- a/hotspot/src/share/vm/services/mallocTracker.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/services/mallocTracker.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -51,14 +51,6 @@ return amount; } - -void MallocMemorySnapshot::reset() { - _tracking_header.reset(); - for (int index = 0; index < mt_number_of_types; index ++) { - _malloc[index].reset(); - } -} - // Make adjustment by subtracting chunks used by arenas // from total chunks to get total free chunck size void MallocMemorySnapshot::make_adjustment() { @@ -116,14 +108,9 @@ bool MallocTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) { assert(from != NMT_off, "Can not transition from off state"); assert(to != NMT_off, "Can not transition to off state"); - if (from == NMT_minimal) { - MallocMemorySummary::reset(); - } + assert (from != NMT_minimal, "cannot transition from minimal state"); - if (to == NMT_detail) { - assert(from == NMT_minimal || from == NMT_summary, "Just check"); - return MallocSiteTable::initialize(); - } else if (from == NMT_detail) { + if (from == NMT_detail) { assert(to == NMT_minimal || to == NMT_summary, "Just check"); MallocSiteTable::shutdown(); } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/services/mallocTracker.hpp --- a/hotspot/src/share/vm/services/mallocTracker.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/services/mallocTracker.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -51,14 +51,6 @@ DEBUG_ONLY(_peak_size = 0;) } - // Reset counters - void reset() { - _size = 0; - _count = 0; - DEBUG_ONLY(_peak_size = 0;) - DEBUG_ONLY(_peak_count = 0;) - } - inline void allocate(size_t sz) { Atomic::add(1, (volatile MemoryCounterType*)&_count); if (sz > 0) { @@ -124,11 +116,6 @@ _arena.resize(sz); } - void reset() { - _malloc.reset(); - _arena.reset(); - } - inline size_t malloc_size() const { return _malloc.size(); } inline size_t malloc_count() const { return _malloc.count();} inline size_t arena_size() const { return _arena.size(); } @@ -176,8 +163,6 @@ return s->by_type(mtThreadStack)->malloc_count(); } - void reset(); - void copy_to(MallocMemorySnapshot* s) { s->_tracking_header = _tracking_header; for (int index = 0; index < mt_number_of_types; index ++) { @@ -240,11 +225,6 @@ return as_snapshot()->malloc_overhead()->size(); } - // Reset all counters to zero - static void reset() { - as_snapshot()->reset(); - } - static MallocMemorySnapshot* as_snapshot() { return (MallocMemorySnapshot*)_snapshot; } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/services/memBaseline.hpp --- a/hotspot/src/share/vm/services/memBaseline.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/services/memBaseline.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -90,10 +90,6 @@ _class_count(0) { } - ~MemBaseline() { - reset(); - } - bool baseline(bool summaryOnly = true); BaselineType baseline_type() const { return _baseline_type; } @@ -169,8 +165,7 @@ // reset the baseline for reuse void reset() { _baseline_type = Not_baselined; - _malloc_memory_snapshot.reset(); - _virtual_memory_snapshot.reset(); + // _malloc_memory_snapshot and _virtual_memory_snapshot are copied over. _class_count = 0; _malloc_sites.clear(); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/services/memReporter.hpp --- a/hotspot/src/share/vm/services/memReporter.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/services/memReporter.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -96,20 +96,6 @@ size_t _class_count; public: - // Report summary tracking data from global snapshots directly. - // This constructor is used for final reporting and hs_err reporting. - MemSummaryReporter(MallocMemorySnapshot* malloc_snapshot, - VirtualMemorySnapshot* vm_snapshot, outputStream* output, - size_t class_count = 0, size_t scale = K) : - MemReporterBase(output, scale), - _malloc_snapshot(malloc_snapshot), - _vm_snapshot(vm_snapshot) { - if (class_count == 0) { - _class_count = InstanceKlass::number_of_instance_classes(); - } else { - _class_count = class_count; - } - } // This constructor is for normal reporting from a recent baseline. MemSummaryReporter(MemBaseline& baseline, outputStream* output, size_t scale = K) : MemReporterBase(output, scale), diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/services/memTracker.cpp --- a/hotspot/src/share/vm/services/memTracker.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/services/memTracker.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -144,11 +144,9 @@ } -// Shutdown can only be issued via JCmd, and NMT JCmd is serialized -// by lock +// Shutdown can only be issued via JCmd, and NMT JCmd is serialized by lock void MemTracker::shutdown() { - // We can only shutdown NMT to minimal tracking level if it is - // ever on. + // We can only shutdown NMT to minimal tracking level if it is ever on. if (tracking_level () > NMT_minimal) { transition_to(NMT_minimal); } @@ -157,45 +155,36 @@ bool MemTracker::transition_to(NMT_TrackingLevel level) { NMT_TrackingLevel current_level = tracking_level(); + assert(level != NMT_off || current_level == NMT_off, "Cannot transition NMT to off"); + if (current_level == level) { return true; } else if (current_level > level) { - // Downgrade tracking level, we want to lower the tracking - // level first + // Downgrade tracking level, we want to lower the tracking level first _tracking_level = level; // Make _tracking_level visible immediately. OrderAccess::fence(); VirtualMemoryTracker::transition(current_level, level); MallocTracker::transition(current_level, level); - - if (level == NMT_minimal) _baseline.reset(); } else { - VirtualMemoryTracker::transition(current_level, level); - MallocTracker::transition(current_level, level); - - _tracking_level = level; - // Make _tracking_level visible immediately. - OrderAccess::fence(); + // Upgrading tracking level is not supported and has never been supported. + // Allocating and deallocating malloc tracking structures is not thread safe and + // leads to inconsistencies unless a lot coarser locks are added. } - return true; } -void MemTracker::final_report(outputStream* output) { - assert(output != NULL, "No output stream"); - if (tracking_level() >= NMT_summary) { - MallocMemorySnapshot* malloc_memory_snapshot = - MallocMemorySummary::as_snapshot(); - malloc_memory_snapshot->make_adjustment(); - - VirtualMemorySnapshot* virtual_memory_snapshot = - VirtualMemorySummary::as_snapshot(); - - MemSummaryReporter rptr(malloc_memory_snapshot, - virtual_memory_snapshot, output); - rptr.report(); - // shutdown NMT, the data no longer accurate - shutdown(); +void MemTracker::report(bool summary_only, outputStream* output) { + assert(output != NULL, "No output stream"); + MemBaseline baseline; + if (baseline.baseline(summary_only)) { + if (summary_only) { + MemSummaryReporter rpt(baseline, output); + rpt.report(); + } else { + MemDetailReporter rpt(baseline, output); + rpt.report(); + } } } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/services/memTracker.hpp --- a/hotspot/src/share/vm/services/memTracker.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/services/memTracker.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -70,6 +70,7 @@ static inline void release_thread_stack(void* addr, size_t size) { } static void final_report(outputStream*) { } + static void error_report(outputStream*) { } }; #else @@ -270,13 +271,20 @@ // other tools. static inline Mutex* query_lock() { return _query_lock; } - // Make a final report and shutdown. - // This function generates summary report without creating snapshots, - // to avoid additional memory allocation. It uses native memory summary - // counters, and makes adjustment to them, once the adjustment is made, - // the counters are no longer accurate. As the result, this function - // should only be used for final reporting before shutting down. - static void final_report(outputStream*); + // Make a final report or report for hs_err file. + static void error_report(outputStream* output) { + if (tracking_level() >= NMT_summary) { + report(true, output); // just print summary for error case. + } + } + + static void final_report(outputStream* output) { + NMT_TrackingLevel level = tracking_level(); + if (level >= NMT_summary) { + report(level == NMT_summary, output); + } + } + // Stored baseline static inline MemBaseline& get_baseline() { @@ -291,6 +299,7 @@ private: static NMT_TrackingLevel init_tracking_level(); + static void report(bool summary_only, outputStream* output); private: // Tracking level diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/services/virtualMemoryTracker.cpp --- a/hotspot/src/share/vm/services/virtualMemoryTracker.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/services/virtualMemoryTracker.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -443,26 +443,28 @@ bool VirtualMemoryTracker::walk_virtual_memory(VirtualMemoryWalker* walker) { assert(_reserved_regions != NULL, "Sanity check"); ThreadCritical tc; - LinkedListNode* head = _reserved_regions->head(); - while (head != NULL) { - const ReservedMemoryRegion* rgn = head->peek(); - if (!walker->do_allocation_site(rgn)) { - return false; + // Check that the _reserved_regions haven't been deleted. + if (_reserved_regions != NULL) { + LinkedListNode* head = _reserved_regions->head(); + while (head != NULL) { + const ReservedMemoryRegion* rgn = head->peek(); + if (!walker->do_allocation_site(rgn)) { + return false; + } + head = head->next(); } - head = head->next(); - } + } return true; } // Transition virtual memory tracking level. bool VirtualMemoryTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) { - if (from == NMT_minimal) { - assert(to == NMT_summary || to == NMT_detail, "Just check"); - VirtualMemorySummary::reset(); - } else if (to == NMT_minimal) { + assert (from != NMT_minimal, "cannot convert from the lowest tracking level to anything"); + if (to == NMT_minimal) { assert(from == NMT_summary || from == NMT_detail, "Just check"); // Clean up virtual memory tracking data structures. ThreadCritical tc; + // Check for potential race with other thread calling transition if (_reserved_regions != NULL) { delete _reserved_regions; _reserved_regions = NULL; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/services/virtualMemoryTracker.hpp --- a/hotspot/src/share/vm/services/virtualMemoryTracker.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/services/virtualMemoryTracker.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -62,11 +62,6 @@ _committed -= sz; } - void reset() { - _reserved = 0; - _committed = 0; - } - inline size_t reserved() const { return _reserved; } inline size_t committed() const { return _committed; } }; @@ -123,12 +118,6 @@ return amount; } - inline void reset() { - for (int index = 0; index < mt_number_of_types; index ++) { - _virtual_memory[index].reset(); - } - } - void copy_to(VirtualMemorySnapshot* s) { for (int index = 0; index < mt_number_of_types; index ++) { s->_virtual_memory[index] = _virtual_memory[index]; @@ -174,10 +163,6 @@ as_snapshot()->copy_to(s); } - static inline void reset() { - as_snapshot()->reset(); - } - static VirtualMemorySnapshot* as_snapshot() { return (VirtualMemorySnapshot*)_snapshot; } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/utilities/globalDefinitions.hpp --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp Thu Oct 23 13:44:59 2014 -0700 @@ -540,7 +540,9 @@ // The expected size in bytes of a cache line, used to pad data structures. -#define DEFAULT_CACHE_LINE_SIZE 64 +#ifndef DEFAULT_CACHE_LINE_SIZE + #define DEFAULT_CACHE_LINE_SIZE 64 +#endif //---------------------------------------------------------------------------------------------------- diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/src/share/vm/utilities/vmError.cpp --- a/hotspot/src/share/vm/utilities/vmError.cpp Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/src/share/vm/utilities/vmError.cpp Thu Oct 23 13:44:59 2014 -0700 @@ -740,7 +740,7 @@ STEP(228, "(Native Memory Tracking)" ) if (_verbose) { - MemTracker::final_report(st); + MemTracker::error_report(st); } STEP(230, "" ) diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java Thu Oct 23 13:44:59 2014 -0700 @@ -0,0 +1,359 @@ +/* + * 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. + */ + +import com.oracle.java.testlibrary.*; + +/* + * @test CheckCompileThresholdScaling + * @bug 8059604 + * @summary "Add CompileThresholdScalingPercentage flag to control when methods are first compiled (with +/-TieredCompilation)" + * @library /testlibrary + * @run main CheckCompileThresholdScaling + */ + +public class CheckCompileThresholdScaling { + + // The flag CompileThresholdScaling scales compilation thresholds + // in the following way: + // + // - if CompileThresholdScaling==1.0, the default threshold values + // are used; + // + // - if CompileThresholdScaling>1.0, threshold values are scaled + // up (e.g., CompileThresholdScalingPercentage=1.2 scales up + // thresholds by a factor of 1.2X); + // + // - if CompileThresholdScaling<1.0, threshold values are scaled + // down; + // + // - if CompileThresholdScaling==0, compilation is disabled + // (equivalent to using -Xint). + // + // With tiered compilation enabled, the values of the following + // flags are changed: + // + // Tier0InvokeNotifyFreqLog, Tier0BackedgeNotifyFreqLog, + // Tier3InvocationThreshold, Tier3MinInvocationThreshold, + // Tier3CompileThreshold, and Tier3BackEdgeThreshold, + // Tier2InvokeNotifyFreqLog, Tier2BackedgeNotifyFreqLog, + // Tier3InvokeNotifyFreqLog, Tier3BackedgeNotifyFreqLog, + // Tier23InlineeNotifyFreqLog, Tier4InvocationThreshold, + // Tier4MinInvocationThreshold, Tier4CompileThreshold, + // Tier4BackEdgeThreshold + // + // With tiered compilation disabled the value of CompileThreshold + // is scaled. + private static final String[][] NON_TIERED_ARGUMENTS = { + { + "-XX:-TieredCompilation", + "-XX:+PrintFlagsFinal", + "-XX:CompileThreshold=1000", + "-version" + }, + { + "-XX:-TieredCompilation", + "-XX:+PrintFlagsFinal", + "-XX:CompileThreshold=1000", + "-XX:CompileThresholdScaling=1.25", + "-version" + }, + { + "-XX:-TieredCompilation", + "-XX:+PrintFlagsFinal", + "-XX:CompileThreshold=1000", + "-XX:CompileThresholdScaling=0.75", + "-version" + }, + { + "-XX:-TieredCompilation", + "-XX:+PrintFlagsFinal", + "-XX:CompileThreshold=0", + "-XX:CompileThresholdScaling=0.75", + "-version" + } + + }; + + private static final String[][] NON_TIERED_EXPECTED_OUTPUTS = { + { + "intx CompileThreshold := 1000 {pd product}", + "double CompileThresholdScaling = 1.000000 {product}" + }, + { + "intx CompileThreshold := 1250 {pd product}", + "double CompileThresholdScaling := 1.250000 {product}" + }, + { + "intx CompileThreshold := 750 {pd product}", + "double CompileThresholdScaling := 0.750000 {product}" + }, + { + "intx CompileThreshold := 0 {pd product}", + "double CompileThresholdScaling := 0.750000 {product}", + "interpreted mode" + } + }; + + private static final String[][] TIERED_ARGUMENTS = { + { + "-XX:+TieredCompilation", + "-XX:+PrintFlagsFinal", + "-XX:Tier0InvokeNotifyFreqLog=7", + "-XX:Tier0BackedgeNotifyFreqLog=10", + "-XX:Tier3InvocationThreshold=200", + "-XX:Tier3MinInvocationThreshold=100", + "-XX:Tier3CompileThreshold=2000", + "-XX:Tier3BackEdgeThreshold=60000", + "-XX:Tier2InvokeNotifyFreqLog=11", + "-XX:Tier2BackedgeNotifyFreqLog=14", + "-XX:Tier3InvokeNotifyFreqLog=10", + "-XX:Tier3BackedgeNotifyFreqLog=13", + "-XX:Tier23InlineeNotifyFreqLog=20", + "-XX:Tier4InvocationThreshold=5000", + "-XX:Tier4MinInvocationThreshold=600", + "-XX:Tier4CompileThreshold=15000", + "-XX:Tier4BackEdgeThreshold=40000", + "-version" + }, + { + "-XX:+TieredCompilation", + "-XX:+PrintFlagsFinal", + "-XX:Tier0InvokeNotifyFreqLog=7", + "-XX:Tier0BackedgeNotifyFreqLog=10", + "-XX:Tier3InvocationThreshold=200", + "-XX:Tier3MinInvocationThreshold=100", + "-XX:Tier3CompileThreshold=2000", + "-XX:Tier3BackEdgeThreshold=60000", + "-XX:Tier2InvokeNotifyFreqLog=11", + "-XX:Tier2BackedgeNotifyFreqLog=14", + "-XX:Tier3InvokeNotifyFreqLog=10", + "-XX:Tier3BackedgeNotifyFreqLog=13", + "-XX:Tier23InlineeNotifyFreqLog=20", + "-XX:Tier4InvocationThreshold=5000", + "-XX:Tier4MinInvocationThreshold=600", + "-XX:Tier4CompileThreshold=15000", + "-XX:Tier4BackEdgeThreshold=40000", + "-XX:CompileThresholdScaling=0.75", + "-version" + }, + { + "-XX:+TieredCompilation", + "-XX:+PrintFlagsFinal", + "-XX:Tier0InvokeNotifyFreqLog=7", + "-XX:Tier0BackedgeNotifyFreqLog=10", + "-XX:Tier3InvocationThreshold=200", + "-XX:Tier3MinInvocationThreshold=100", + "-XX:Tier3CompileThreshold=2000", + "-XX:Tier3BackEdgeThreshold=60000", + "-XX:Tier2InvokeNotifyFreqLog=11", + "-XX:Tier2BackedgeNotifyFreqLog=14", + "-XX:Tier3InvokeNotifyFreqLog=10", + "-XX:Tier3BackedgeNotifyFreqLog=13", + "-XX:Tier23InlineeNotifyFreqLog=20", + "-XX:Tier4InvocationThreshold=5000", + "-XX:Tier4MinInvocationThreshold=600", + "-XX:Tier4CompileThreshold=15000", + "-XX:Tier4BackEdgeThreshold=40000", + "-XX:CompileThresholdScaling=1.25", + "-version" + }, + { + "-XX:+TieredCompilation", + "-XX:+PrintFlagsFinal", + "-XX:Tier0InvokeNotifyFreqLog=7", + "-XX:Tier0BackedgeNotifyFreqLog=10", + "-XX:Tier3InvocationThreshold=200", + "-XX:Tier3MinInvocationThreshold=100", + "-XX:Tier3CompileThreshold=2000", + "-XX:Tier3BackEdgeThreshold=60000", + "-XX:Tier2InvokeNotifyFreqLog=11", + "-XX:Tier2BackedgeNotifyFreqLog=14", + "-XX:Tier3InvokeNotifyFreqLog=10", + "-XX:Tier3BackedgeNotifyFreqLog=13", + "-XX:Tier23InlineeNotifyFreqLog=20", + "-XX:Tier4InvocationThreshold=5000", + "-XX:Tier4MinInvocationThreshold=600", + "-XX:Tier4CompileThreshold=15000", + "-XX:Tier4BackEdgeThreshold=40000", + "-XX:CompileThresholdScaling=2.0", + "-version" + }, + { + "-XX:+TieredCompilation", + "-XX:+PrintFlagsFinal", + "-XX:Tier0InvokeNotifyFreqLog=7", + "-XX:Tier0BackedgeNotifyFreqLog=10", + "-XX:Tier3InvocationThreshold=200", + "-XX:Tier3MinInvocationThreshold=100", + "-XX:Tier3CompileThreshold=2000", + "-XX:Tier3BackEdgeThreshold=60000", + "-XX:Tier2InvokeNotifyFreqLog=11", + "-XX:Tier2BackedgeNotifyFreqLog=14", + "-XX:Tier3InvokeNotifyFreqLog=10", + "-XX:Tier3BackedgeNotifyFreqLog=13", + "-XX:Tier23InlineeNotifyFreqLog=20", + "-XX:Tier4InvocationThreshold=5000", + "-XX:Tier4MinInvocationThreshold=600", + "-XX:Tier4CompileThreshold=15000", + "-XX:Tier4BackEdgeThreshold=40000", + "-XX:CompileThresholdScaling=0.0", + "-version" + } + }; + + private static final String[][] TIERED_EXPECTED_OUTPUTS = { + { + "intx Tier0BackedgeNotifyFreqLog := 10 {product}", + "intx Tier0InvokeNotifyFreqLog := 7 {product}", + "intx Tier23InlineeNotifyFreqLog := 20 {product}", + "intx Tier2BackedgeNotifyFreqLog := 14 {product}", + "intx Tier2InvokeNotifyFreqLog := 11 {product}", + "intx Tier3BackEdgeThreshold := 60000 {product}", + "intx Tier3BackedgeNotifyFreqLog := 13 {product}", + "intx Tier3CompileThreshold := 2000 {product}", + "intx Tier3InvocationThreshold := 200 {product}", + "intx Tier3InvokeNotifyFreqLog := 10 {product}", + "intx Tier3MinInvocationThreshold := 100 {product}", + "intx Tier4BackEdgeThreshold := 40000 {product}", + "intx Tier4CompileThreshold := 15000 {product}", + "intx Tier4InvocationThreshold := 5000 {product}", + "intx Tier4MinInvocationThreshold := 600 {product}", + "double CompileThresholdScaling = 1.000000 {product}" + }, + { + "intx Tier0BackedgeNotifyFreqLog := 9 {product}", + "intx Tier0InvokeNotifyFreqLog := 6 {product}", + "intx Tier23InlineeNotifyFreqLog := 19 {product}", + "intx Tier2BackedgeNotifyFreqLog := 13 {product}", + "intx Tier2InvokeNotifyFreqLog := 10 {product}", + "intx Tier3BackEdgeThreshold := 45000 {product}", + "intx Tier3BackedgeNotifyFreqLog := 12 {product}", + "intx Tier3CompileThreshold := 1500 {product}", + "intx Tier3InvocationThreshold := 150 {product}", + "intx Tier3InvokeNotifyFreqLog := 9 {product}", + "intx Tier3MinInvocationThreshold := 75 {product}", + "intx Tier4BackEdgeThreshold := 30000 {product}", + "intx Tier4CompileThreshold := 11250 {product}", + "intx Tier4InvocationThreshold := 3750 {product}", + "intx Tier4MinInvocationThreshold := 450 {product}", + "double CompileThresholdScaling := 0.750000 {product}" + }, + { + "intx Tier0BackedgeNotifyFreqLog := 10 {product}", + "intx Tier0InvokeNotifyFreqLog := 7 {product}", + "intx Tier23InlineeNotifyFreqLog := 20 {product}", + "intx Tier2BackedgeNotifyFreqLog := 14 {product}", + "intx Tier2InvokeNotifyFreqLog := 11 {product}", + "intx Tier3BackEdgeThreshold := 75000 {product}", + "intx Tier3BackedgeNotifyFreqLog := 13 {product}", + "intx Tier3CompileThreshold := 2500 {product}", + "intx Tier3InvocationThreshold := 250 {product}", + "intx Tier3InvokeNotifyFreqLog := 10 {product}", + "intx Tier3MinInvocationThreshold := 125 {product}", + "intx Tier4BackEdgeThreshold := 50000 {product}", + "intx Tier4CompileThreshold := 18750 {product}", + "intx Tier4InvocationThreshold := 6250 {product}", + "intx Tier4MinInvocationThreshold := 750 {product}", + "double CompileThresholdScaling := 1.250000 {product}" + }, + { + "intx Tier0BackedgeNotifyFreqLog := 11 {product}", + "intx Tier0InvokeNotifyFreqLog := 8 {product}", + "intx Tier23InlineeNotifyFreqLog := 21 {product}", + "intx Tier2BackedgeNotifyFreqLog := 15 {product}", + "intx Tier2InvokeNotifyFreqLog := 12 {product}", + "intx Tier3BackEdgeThreshold := 120000 {product}", + "intx Tier3BackedgeNotifyFreqLog := 14 {product}", + "intx Tier3CompileThreshold := 4000 {product}", + "intx Tier3InvocationThreshold := 400 {product}", + "intx Tier3InvokeNotifyFreqLog := 11 {product}", + "intx Tier3MinInvocationThreshold := 200 {product}", + "intx Tier4BackEdgeThreshold := 80000 {product}", + "intx Tier4CompileThreshold := 30000 {product}", + "intx Tier4InvocationThreshold := 10000 {product}", + "intx Tier4MinInvocationThreshold := 1200 {product}", + "double CompileThresholdScaling := 2.000000 {product}" + }, + { + "intx Tier0BackedgeNotifyFreqLog := 0 {product}", + "intx Tier0InvokeNotifyFreqLog := 0 {product}", + "intx Tier23InlineeNotifyFreqLog := 0 {product}", + "intx Tier2BackedgeNotifyFreqLog := 0 {product}", + "intx Tier2InvokeNotifyFreqLog := 0 {product}", + "intx Tier3BackEdgeThreshold := 0 {product}", + "intx Tier3BackedgeNotifyFreqLog := 0 {product}", + "intx Tier3CompileThreshold := 0 {product}", + "intx Tier3InvocationThreshold := 0 {product}", + "intx Tier3InvokeNotifyFreqLog := 0 {product}", + "intx Tier3MinInvocationThreshold := 0 {product}", + "intx Tier4BackEdgeThreshold := 0 {product}", + "intx Tier4CompileThreshold := 0 {product}", + "intx Tier4InvocationThreshold := 0 {product}", + "intx Tier4MinInvocationThreshold := 0 {product}", + "double CompileThresholdScaling := 0.000000 {product}", + "interpreted mode" + } + }; + + private static void verifyValidOption(String[] arguments, String[] expected_outputs, boolean tiered) throws Exception { + ProcessBuilder pb; + OutputAnalyzer out; + + pb = ProcessTools.createJavaProcessBuilder(arguments); + out = new OutputAnalyzer(pb.start()); + + try { + for (String expected_output : expected_outputs) { + out.shouldContain(expected_output); + } + out.shouldHaveExitValue(0); + } catch (RuntimeException e) { + // Check if tiered compilation is available in this JVM + // Version. Throw exception only if it is available. + if (!(tiered && out.getOutput().contains("Client VM warning: TieredCompilation is disabled in this release."))) { + throw new RuntimeException(e); + } + } + } + + public static void main(String[] args) throws Exception { + + if (NON_TIERED_ARGUMENTS.length != NON_TIERED_EXPECTED_OUTPUTS.length) { + throw new RuntimeException("Test is set up incorrectly: length of arguments and expected outputs in non-tiered mode of operation does not match."); + } + + if (TIERED_ARGUMENTS.length != TIERED_EXPECTED_OUTPUTS.length) { + throw new RuntimeException("Test is set up incorrectly: length of arguments and expected outputs in tiered mode of operation."); + } + + // Check if thresholds are scaled properly in non-tiered mode of operation + for (int i = 0; i < NON_TIERED_ARGUMENTS.length; i++) { + verifyValidOption(NON_TIERED_ARGUMENTS[i], NON_TIERED_EXPECTED_OUTPUTS[i], false); + } + + // Check if thresholds are scaled properly in tiered mode of operation + for (int i = 0; i < TIERED_ARGUMENTS.length; i++) { + verifyValidOption(TIERED_ARGUMENTS[i], TIERED_EXPECTED_OUTPUTS[i], true); + } + } +} diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/compiler/oracle/CheckCompileCommandOption.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/oracle/CheckCompileCommandOption.java Thu Oct 23 13:44:59 2014 -0700 @@ -0,0 +1,216 @@ +/* + * 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. + */ + +import com.oracle.java.testlibrary.*; + +/* + * @test CheckCompileCommandOption + * @bug 8055286 8056964 8059847 + * @summary "Checks parsing of -XX:+CompileCommand=option" + * @library /testlibrary + * @run main CheckCompileCommandOption + */ + +public class CheckCompileCommandOption { + + // Currently, two types of trailing options can be used with + // -XX:CompileCommand=option + // + // (1) CompileCommand=option,Klass::method,flag + // (2) CompileCommand=option,Klass::method,type,flag,value + // + // Type (1) is used to enable a boolean flag for a method. + // + // Type (2) is used to support flags with a value. Values can + // have the the following types: intx, uintx, bool, ccstr, + // ccstrlist, and double. + + private static final String[][] TYPE_1_ARGUMENTS = { + { + "-XX:CompileCommand=option,com/oracle/Test.test,MyBoolOption1", + "-XX:CompileCommand=option,com/oracle/Test,test,MyBoolOption2", + "-XX:CompileCommand=option,com.oracle.Test::test,MyBoolOption3", + "-XX:CompileCommand=option,com/oracle/Test::test,MyBoolOption4", + "-version" + }, + { + "-XX:CompileCommand=option,com/oracle/Test.test,MyBoolOption1,MyBoolOption2", + "-version" + }, + { + "-XX:CompileCommand=option,com/oracle/Test,test,MyBoolOption1,MyBoolOption2", + "-version" + } + }; + + private static final String[][] TYPE_1_EXPECTED_OUTPUTS = { + { + "CompilerOracle: option com/oracle/Test.test bool MyBoolOption1 = true", + "CompilerOracle: option com/oracle/Test.test bool MyBoolOption2 = true", + "CompilerOracle: option com/oracle/Test.test bool MyBoolOption3 = true", + "CompilerOracle: option com/oracle/Test.test bool MyBoolOption4 = true" + }, + { + "CompilerOracle: option com/oracle/Test.test bool MyBoolOption1 = true", + "CompilerOracle: option com/oracle/Test.test bool MyBoolOption2 = true", + }, + { + "CompilerOracle: option com/oracle/Test.test bool MyBoolOption1 = true", + "CompilerOracle: option com/oracle/Test.test bool MyBoolOption2 = true", + } + }; + + private static final String[][] TYPE_2_ARGUMENTS = { + { + "-XX:CompileCommand=option,Test::test,ccstrlist,MyListOption,_foo,_bar", + "-XX:CompileCommand=option,Test::test,ccstr,MyStrOption,_foo", + "-XX:CompileCommand=option,Test::test,bool,MyBoolOption,false", + "-XX:CompileCommand=option,Test::test,intx,MyIntxOption,-1", + "-XX:CompileCommand=option,Test::test,uintx,MyUintxOption,1", + "-XX:CompileCommand=option,Test::test,MyFlag", + "-XX:CompileCommand=option,Test::test,double,MyDoubleOption,1.123", + "-version" + }, + { + "-XX:CompileCommand=option,Test.test,double,MyDoubleOption,1.123", + "-version" + }, + { + "-XX:CompileCommand=option,Test::test,bool,MyBoolOption,false,intx,MyIntxOption,-1,uintx,MyUintxOption,1,MyFlag,double,MyDoubleOption,1.123", + "-version" + } + }; + + private static final String[][] TYPE_2_EXPECTED_OUTPUTS = { + { + "CompilerOracle: option Test.test const char* MyListOption = '_foo _bar'", + "CompilerOracle: option Test.test const char* MyStrOption = '_foo'", + "CompilerOracle: option Test.test bool MyBoolOption = false", + "CompilerOracle: option Test.test intx MyIntxOption = -1", + "CompilerOracle: option Test.test uintx MyUintxOption = 1", + "CompilerOracle: option Test.test bool MyFlag = true", + "CompilerOracle: option Test.test double MyDoubleOption = 1.123000" + }, + { + "CompilerOracle: option Test.test double MyDoubleOption = 1.123000" + }, + { + "CompilerOracle: option Test.test bool MyBoolOption = false", + "CompilerOracle: option Test.test intx MyIntxOption = -1", + "CompilerOracle: option Test.test uintx MyUintxOption = 1", + "CompilerOracle: option Test.test bool MyFlag = true", + "CompilerOracle: option Test.test double MyDoubleOption = 1.123000", + } + }; + + private static final String[][] TYPE_2_INVALID_ARGUMENTS = { + { + // bool flag name missing + "-XX:CompileCommand=option,Test::test,bool", + "-version" + }, + { + // bool flag value missing + "-XX:CompileCommand=option,Test::test,bool,MyBoolOption", + "-version" + }, + { + // wrong value for bool flag + "-XX:CompileCommand=option,Test::test,bool,MyBoolOption,100", + "-version" + }, + { + // intx flag name missing + "-XX:CompileCommand=option,Test::test,bool,MyBoolOption,false,intx", + "-version" + }, + { + // intx flag value missing + "-XX:CompileCommand=option,Test::test,bool,MyBoolOption,false,intx,MyIntOption", + "-version" + }, + { + // wrong value for intx flag + "-XX:CompileCommand=option,Test::test,bool,MyBoolOption,false,intx,MyIntOption,true", + "-version" + }, + { + // wrong value for flag double flag + "-XX:CompileCommand=option,Test::test,double,MyDoubleOption,1", + "-version" + } + }; + + private static void verifyValidOption(String[] arguments, String[] expected_outputs) throws Exception { + ProcessBuilder pb; + OutputAnalyzer out; + + pb = ProcessTools.createJavaProcessBuilder(arguments); + out = new OutputAnalyzer(pb.start()); + + for (String expected_output : expected_outputs) { + out.shouldContain(expected_output); + } + + out.shouldNotContain("CompilerOracle: unrecognized line"); + out.shouldHaveExitValue(0); + } + + private static void verifyInvalidOption(String[] arguments) throws Exception { + ProcessBuilder pb; + OutputAnalyzer out; + + pb = ProcessTools.createJavaProcessBuilder(arguments); + out = new OutputAnalyzer(pb.start()); + + out.shouldContain("CompilerOracle: unrecognized line"); + out.shouldHaveExitValue(0); + } + + public static void main(String[] args) throws Exception { + + if (TYPE_1_ARGUMENTS.length != TYPE_1_EXPECTED_OUTPUTS.length) { + throw new RuntimeException("Test is set up incorrectly: length of arguments and expected outputs for type (1) options does not match."); + } + + if (TYPE_2_ARGUMENTS.length != TYPE_2_EXPECTED_OUTPUTS.length) { + throw new RuntimeException("Test is set up incorrectly: length of arguments and expected outputs for type (2) options does not match."); + } + + // Check if type (1) options are parsed correctly + for (int i = 0; i < TYPE_1_ARGUMENTS.length; i++) { + verifyValidOption(TYPE_1_ARGUMENTS[i], TYPE_1_EXPECTED_OUTPUTS[i]); + } + + // Check if type (2) options are parsed correctly + for (int i = 0; i < TYPE_2_ARGUMENTS.length; i++) { + verifyValidOption(TYPE_2_ARGUMENTS[i], TYPE_2_EXPECTED_OUTPUTS[i]); + } + + // Check if error is reported for invalid type (2) options + // (flags with type information specified) + for (String[] arguments: TYPE_2_INVALID_ARGUMENTS) { + verifyInvalidOption(arguments); + } + } +} diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/compiler/tiered/NonTieredLevelsTest.java --- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java Thu Oct 23 13:44:59 2014 -0700 @@ -26,7 +26,6 @@ /** * @test NonTieredLevelsTest * @library /testlibrary /testlibrary/whitebox /compiler/whitebox - * @ignore 8046268 * @build NonTieredLevelsTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/compiler/tiered/TieredLevelsTest.java --- a/hotspot/test/compiler/tiered/TieredLevelsTest.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/test/compiler/tiered/TieredLevelsTest.java Thu Oct 23 13:44:59 2014 -0700 @@ -24,7 +24,6 @@ /** * @test TieredLevelsTest * @library /testlibrary /testlibrary/whitebox /compiler/whitebox - * @ignore 8046268 * @build TieredLevelsTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/compiler/whitebox/ClearMethodStateTest.java --- a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java Thu Oct 23 13:44:59 2014 -0700 @@ -27,7 +27,6 @@ * @test ClearMethodStateTest * @bug 8006683 8007288 8022832 * @library /testlibrary /testlibrary/whitebox - * @ignore 8046268 * @build ClearMethodStateTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java --- a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java Thu Oct 23 13:44:59 2014 -0700 @@ -69,10 +69,12 @@ /** Flag for verbose output, true if {@code -Dverbose} specified */ protected static final boolean IS_VERBOSE = System.getProperty("verbose") != null; - /** count of invocation to triger compilation */ + /** invocation count to trigger compilation */ protected static final int THRESHOLD; - /** count of invocation to triger OSR compilation */ + /** invocation count to trigger OSR compilation */ protected static final long BACKEDGE_THRESHOLD; + /** invocation count to warm up method before triggering OSR compilation */ + protected static final long OSR_WARMUP = 2000; /** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */ protected static final String MODE = System.getProperty("java.vm.info"); @@ -216,15 +218,19 @@ * compilation level. */ protected final void checkNotCompiled() { - if (WHITE_BOX.isMethodQueuedForCompilation(method)) { - throw new RuntimeException(method + " must not be in queue"); - } if (WHITE_BOX.isMethodCompiled(method, false)) { throw new RuntimeException(method + " must be not compiled"); } if (WHITE_BOX.getMethodCompilationLevel(method, false) != 0) { throw new RuntimeException(method + " comp_level must be == 0"); } + checkNotOsrCompiled(); + } + + protected final void checkNotOsrCompiled() { + if (WHITE_BOX.isMethodQueuedForCompilation(method)) { + throw new RuntimeException(method + " must not be in queue"); + } if (WHITE_BOX.isMethodCompiled(method, true)) { throw new RuntimeException(method + " must be not osr_compiled"); } @@ -295,12 +301,21 @@ * Waits for completion of background compilation of {@linkplain #method}. */ protected final void waitBackgroundCompilation() { + waitBackgroundCompilation(method); + } + + /** + * Waits for completion of background compilation of the given executable. + * + * @param executable Executable + */ + protected static final void waitBackgroundCompilation(Executable executable) { if (!BACKGROUND_COMPILATION) { return; } final Object obj = new Object(); for (int i = 0; i < 10 - && WHITE_BOX.isMethodQueuedForCompilation(method); ++i) { + && WHITE_BOX.isMethodQueuedForCompilation(executable); ++i) { synchronized (obj) { try { obj.wait(1000); @@ -414,14 +429,14 @@ /** constructor test case */ CONSTRUCTOR_TEST(Helper.CONSTRUCTOR, Helper.CONSTRUCTOR_CALLABLE, false), /** method test case */ - METOD_TEST(Helper.METHOD, Helper.METHOD_CALLABLE, false), + METHOD_TEST(Helper.METHOD, Helper.METHOD_CALLABLE, false), /** static method test case */ STATIC_TEST(Helper.STATIC, Helper.STATIC_CALLABLE, false), /** OSR constructor test case */ OSR_CONSTRUCTOR_TEST(Helper.OSR_CONSTRUCTOR, Helper.OSR_CONSTRUCTOR_CALLABLE, true), /** OSR method test case */ - OSR_METOD_TEST(Helper.OSR_METHOD, Helper.OSR_METHOD_CALLABLE, true), + OSR_METHOD_TEST(Helper.OSR_METHOD, Helper.OSR_METHOD_CALLABLE, true), /** OSR static method test case */ OSR_STATIC_TEST(Helper.OSR_STATIC, Helper.OSR_STATIC_CALLABLE, true); @@ -483,7 +498,8 @@ = new Callable() { @Override public Integer call() throws Exception { - return new Helper(null).hashCode(); + int result = warmup(OSR_CONSTRUCTOR); + return result + new Helper(null, CompilerWhiteBoxTest.BACKEDGE_THRESHOLD).hashCode(); } }; @@ -493,7 +509,8 @@ @Override public Integer call() throws Exception { - return helper.osrMethod(); + int result = warmup(OSR_METHOD); + return result + helper.osrMethod(CompilerWhiteBoxTest.BACKEDGE_THRESHOLD); } }; @@ -501,10 +518,66 @@ = new Callable() { @Override public Integer call() throws Exception { - return osrStaticMethod(); + int result = warmup(OSR_STATIC); + return result + osrStaticMethod(CompilerWhiteBoxTest.BACKEDGE_THRESHOLD); } }; + /** + * Deoptimizes all non-osr versions of the given executable after + * compilation finished. + * + * @param e Executable + * @throws Exception + */ + private static void waitAndDeoptimize(Executable e) throws Exception { + CompilerWhiteBoxTest.waitBackgroundCompilation(e); + if (WhiteBox.getWhiteBox().isMethodQueuedForCompilation(e)) { + throw new RuntimeException(e + " must not be in queue"); + } + // Deoptimize non-osr versions of executable + WhiteBox.getWhiteBox().deoptimizeMethod(e, false); + } + + /** + * Executes the method multiple times to make sure we have + * enough profiling information before triggering an OSR + * compilation. Otherwise the C2 compiler may add uncommon traps. + * + * @param m Method to be executed + * @return Number of times the method was executed + * @throws Exception + */ + private static int warmup(Method m) throws Exception { + Helper helper = new Helper(); + int result = 0; + for (long i = 0; i < CompilerWhiteBoxTest.OSR_WARMUP; ++i) { + result += (int)m.invoke(helper, 1); + } + // Deoptimize non-osr versions + waitAndDeoptimize(m); + return result; + } + + /** + * Executes the constructor multiple times to make sure we + * have enough profiling information before triggering an OSR + * compilation. Otherwise the C2 compiler may add uncommon traps. + * + * @param c Constructor to be executed + * @return Number of times the constructor was executed + * @throws Exception + */ + private static int warmup(Constructor c) throws Exception { + int result = 0; + for (long i = 0; i < CompilerWhiteBoxTest.OSR_WARMUP; ++i) { + result += c.newInstance(null, 1).hashCode(); + } + // Deoptimize non-osr versions + waitAndDeoptimize(c); + return result; + } + private static final Constructor CONSTRUCTOR; private static final Constructor OSR_CONSTRUCTOR; private static final Method METHOD; @@ -521,25 +594,24 @@ } try { OSR_CONSTRUCTOR = Helper.class.getDeclaredConstructor( - Object.class); + Object.class, long.class); } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException( - "exception on getting method Helper.(Object)", e); + "exception on getting method Helper.(Object, long)", e); } METHOD = getMethod("method"); STATIC = getMethod("staticMethod"); - OSR_METHOD = getMethod("osrMethod"); - OSR_STATIC = getMethod("osrStaticMethod"); + OSR_METHOD = getMethod("osrMethod", long.class); + OSR_STATIC = getMethod("osrStaticMethod", long.class); } - private static Method getMethod(String name) { + private static Method getMethod(String name, Class... parameterTypes) { try { - return Helper.class.getDeclaredMethod(name); + return Helper.class.getDeclaredMethod(name, parameterTypes); } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException( "exception on getting method Helper." + name, e); } - } private static int staticMethod() { @@ -550,17 +622,17 @@ return 42; } - private static int osrStaticMethod() { + private static int osrStaticMethod(long limit) { int result = 0; - for (long i = 0; i < CompilerWhiteBoxTest.BACKEDGE_THRESHOLD; ++i) { + for (long i = 0; i < limit; ++i) { result += staticMethod(); } return result; } - private int osrMethod() { + private int osrMethod(long limit) { int result = 0; - for (long i = 0; i < CompilerWhiteBoxTest.BACKEDGE_THRESHOLD; ++i) { + for (long i = 0; i < limit; ++i) { result += method(); } return result; @@ -574,9 +646,9 @@ } // for OSR constructor test case - private Helper(Object o) { + private Helper(Object o, long limit) { int result = 0; - for (long i = 0; i < CompilerWhiteBoxTest.BACKEDGE_THRESHOLD; ++i) { + for (long i = 0; i < limit; ++i) { result += method(); } x = result; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/compiler/whitebox/DeoptimizeAllTest.java --- a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java Thu Oct 23 13:44:59 2014 -0700 @@ -25,7 +25,6 @@ * @test DeoptimizeAllTest * @bug 8006683 8007288 8022832 * @library /testlibrary /testlibrary/whitebox - * @ignore 8046268 * @build DeoptimizeAllTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java --- a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java Thu Oct 23 13:44:59 2014 -0700 @@ -25,7 +25,6 @@ * @test DeoptimizeMethodTest * @bug 8006683 8007288 8022832 * @library /testlibrary /testlibrary/whitebox - * @ignore 8046268 * @build DeoptimizeMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java --- a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java Thu Oct 23 13:44:59 2014 -0700 @@ -25,7 +25,6 @@ * @test EnqueueMethodForCompilationTest * @bug 8006683 8007288 8022832 * @library /testlibrary /testlibrary/whitebox - * @ignore 8046268 * @build EnqueueMethodForCompilationTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/compiler/whitebox/GetNMethodTest.java --- a/hotspot/test/compiler/whitebox/GetNMethodTest.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java Thu Oct 23 13:44:59 2014 -0700 @@ -28,7 +28,6 @@ * @test GetNMethodTest * @bug 8038240 * @library /testlibrary /testlibrary/whitebox - * @ignore 8046268 * @build GetNMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java --- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java Thu Oct 23 13:44:59 2014 -0700 @@ -25,7 +25,6 @@ * @test MakeMethodNotCompilableTest * @bug 8012322 8006683 8007288 8022832 * @library /testlibrary /testlibrary/whitebox - * @ignore 8046268 * @build MakeMethodNotCompilableTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission @@ -140,7 +139,7 @@ } compile(); - checkNotCompiled(); + checkNotOsrCompiled(); if (isCompilable()) { throw new RuntimeException(method + " must be not compilable"); } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/gc/g1/TestG1TraceReclaimDeadHumongousObjectsAtYoungGC.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/gc/g1/TestG1TraceReclaimDeadHumongousObjectsAtYoungGC.java Thu Oct 23 13:44:59 2014 -0700 @@ -0,0 +1,142 @@ +/* + * 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 TestG1TraceReclaimDeadHumongousObjectsAtYoungGC + * @bug 8058801 + * @summary Ensure that the output for a G1TraceReclaimDeadHumongousObjectsAtYoungGC + * includes the expected necessary messages. + * @key gc + * @library /testlibrary + */ + +import com.oracle.java.testlibrary.ProcessTools; +import com.oracle.java.testlibrary.OutputAnalyzer; +import java.util.LinkedList; + +public class TestG1TraceReclaimDeadHumongousObjectsAtYoungGC { + public static void main(String[] args) throws Exception { + testGCLogs(); + testHumongousObjectGCLogs(); + } + + private static void testGCLogs() throws Exception { + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", + "-Xms128M", + "-Xmx128M", + "-Xmn16M", + "-XX:G1HeapRegionSize=1M", + "-XX:+PrintGC", + "-XX:+UnlockExperimentalVMOptions", + "-XX:G1LogLevel=finest", + "-XX:+G1TraceReclaimDeadHumongousObjectsAtYoungGC", + GCTest.class.getName()); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + + // As G1ReclaimDeadHumongousObjectsAtYoungGC is set(default), below logs should be displayed. + // And GCTest doesn't have humongous objects, so values should be zero. + output.shouldContain("[Humongous Reclaim"); + output.shouldContain("[Humongous Total: 0]"); + output.shouldContain("[Humongous Candidate: 0]"); + output.shouldContain("[Humongous Reclaimed: 0]"); + + output.shouldHaveExitValue(0); + } + + private static void testHumongousObjectGCLogs() throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", + "-Xms128M", + "-Xmx128M", + "-Xmn16M", + "-XX:G1HeapRegionSize=1M", + "-XX:+PrintGC", + "-XX:+UnlockExperimentalVMOptions", + "-XX:G1LogLevel=finest", + "-XX:+G1TraceReclaimDeadHumongousObjectsAtYoungGC", + GCWithHumongousObjectTest.class.getName()); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + + // As G1ReclaimDeadHumongousObjectsAtYoungGC is set(default), below logs should be displayed. + output.shouldContain("[Humongous Reclaim"); + output.shouldContain("[Humongous Total"); + output.shouldContain("[Humongous Candidate"); + output.shouldContain("[Humongous Reclaimed"); + + // As G1TraceReclaimDeadHumongousObjectsAtYoungGC is set and GCWithHumongousObjectTest has humongous objects, + // these logs should be displayed. + output.shouldContain("Live humongous"); + output.shouldContain("Reclaim humongous region"); + output.shouldHaveExitValue(0); + } + + static class GCTest { + private static byte[] garbage; + + public static void main(String [] args) { + System.out.println("Creating garbage"); + // create 128MB of garbage. This should result in at least one GC + for (int i = 0; i < 1024; i++) { + garbage = new byte[128 * 1024]; + } + System.out.println("Done"); + } + } + + static class GCWithHumongousObjectTest { + + public static final int M = 1024*1024; + public static LinkedList garbageList = new LinkedList(); + // A large object referenced by a static. + static int[] filler = new int[10 * M]; + + public static void genGarbage() { + for (int i = 0; i < 32*1024; i++) { + garbageList.add(new int[100]); + } + garbageList.clear(); + } + + public static void main(String[] args) { + + int[] large = new int[M]; + Object ref = large; + + System.out.println("Creating garbage"); + for (int i = 0; i < 100; i++) { + // A large object that will be reclaimed eagerly. + large = new int[6*M]; + genGarbage(); + // Make sure that the compiler cannot completely remove + // the allocation of the large object until here. + System.out.println(large); + } + + // Keep the reference to the first object alive. + System.out.println(ref); + System.out.println("Done"); + } + } +} diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/gc/g1/TestSummarizeRSetStatsThreads.java --- a/hotspot/test/gc/g1/TestSummarizeRSetStatsThreads.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/test/gc/g1/TestSummarizeRSetStatsThreads.java Thu Oct 23 13:44:59 2014 -0700 @@ -53,8 +53,8 @@ // a zero in refinement thread numbers indicates that the value in ParallelGCThreads should be used. // Additionally use at least one thread. - int expectedNumRefinementThreads = refinementThreads == 0 ? workerThreads : refinementThreads; - expectedNumRefinementThreads = Math.max(1, expectedNumRefinementThreads); + int expectedNumRefinementThreads = refinementThreads; + // create the pattern made up of n copies of a floating point number pattern String numberPattern = String.format("%0" + expectedNumRefinementThreads + "d", 0) .replace("0", "\\s+\\d+\\.\\d+"); @@ -73,9 +73,9 @@ return; } // different valid combinations of number of refinement and gc worker threads - runTest(0, 0); - runTest(0, 5); - runTest(5, 0); + runTest(1, 1); + runTest(1, 5); + runTest(5, 1); runTest(10, 10); runTest(1, 2); runTest(4, 3); diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/runtime/NMT/ChangeTrackingLevel.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/runtime/NMT/ChangeTrackingLevel.java Thu Oct 23 13:44:59 2014 -0700 @@ -0,0 +1,51 @@ +/* + * 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 + * 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 8059100 + * @summary Test that you can decrease NMT tracking level but not increase it. + * @key nmt + * @library /testlibrary /testlibrary/whitebox + * @build ChangeTrackingLevel + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail ChangeTrackingLevel + */ + +import com.oracle.java.testlibrary.*; +import sun.hotspot.WhiteBox; + +public class ChangeTrackingLevel { + + public static WhiteBox wb = WhiteBox.getWhiteBox(); + public static void main(String args[]) throws Exception { + boolean testChangeLevel = wb.NMTChangeTrackingLevel(); + if (testChangeLevel) { + System.out.println("NMT level change test passed."); + } else { + // it also fails if the VM asserts. + throw new RuntimeException("NMT level change test failed"); + } + } +}; diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/runtime/NMT/PrintNMTStatistics.java --- a/hotspot/test/runtime/NMT/PrintNMTStatistics.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/test/runtime/NMT/PrintNMTStatistics.java Thu Oct 23 13:44:59 2014 -0700 @@ -24,43 +24,40 @@ /* * @test * @key nmt regression - * @bug 8005936 - * @summary Make sure PrintNMTStatistics works on normal JVM exit - * @library /testlibrary /testlibrary/whitebox - * @build PrintNMTStatistics - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main PrintNMTStatistics + * @bug 8005936 8058606 + * @summary Verify PrintNMTStatistics on normal JVM exit for detail and summary tracking level + * @library /testlibrary */ import com.oracle.java.testlibrary.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import sun.hotspot.WhiteBox; - public class PrintNMTStatistics { - public static void main(String args[]) throws Exception { - - // We start a new java process running with an argument and use WB API to ensure - // we have data for NMT on VM exit - if (args.length > 0) { - return; - } + public static void main(String args[]) throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-XX:+UnlockDiagnosticVMOptions", - "-Xbootclasspath/a:.", - "-XX:+WhiteBoxAPI", - "-XX:NativeMemoryTracking=summary", - "-XX:+PrintNMTStatistics", - "PrintNMTStatistics", - "test"); + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+PrintNMTStatistics", + "-XX:NativeMemoryTracking=detail", + "-version"); + + OutputAnalyzer output_detail = new OutputAnalyzer(pb.start()); + output_detail.shouldContain("Virtual memory map:"); + output_detail.shouldContain("Details:"); + output_detail.shouldNotContain("error"); + output_detail.shouldHaveExitValue(0); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("Java Heap (reserved="); - output.shouldNotContain("error"); - output.shouldHaveExitValue(0); - } + ProcessBuilder pb1 = ProcessTools.createJavaProcessBuilder( + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+PrintNMTStatistics", + "-XX:NativeMemoryTracking=summary", + "-version"); + + OutputAnalyzer output_summary = new OutputAnalyzer(pb1.start()); + output_summary.shouldContain("Java Heap (reserved="); + output_summary.shouldNotContain("Virtual memory map:"); + output_summary.shouldNotContain("Details:"); + output_summary.shouldNotContain("error"); + output_summary.shouldHaveExitValue(0); + } } diff -r c09efaeb7b9f -r e7d87caaae28 hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java --- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Thu Oct 23 11:19:10 2014 -0700 +++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Thu Oct 23 13:44:59 2014 -0700 @@ -101,6 +101,7 @@ public native void NMTOverflowHashBucket(long num); public native long NMTMallocWithPseudoStack(long size, int index); public native boolean NMTIsDetailSupported(); + public native boolean NMTChangeTrackingLevel(); // Compiler public native void deoptimizeAll();