changeset 7273:32706bfa2dfe

Merge
author iveresov
date Fri, 17 Oct 2014 10:09:43 -1000
parents a931540f0543 5c8dffe3d889
children 3c4254d2df12
files
diffstat 94 files changed, 1171 insertions(+), 2105 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Oct 17 08:27:46 2014 +0000
+++ b/.hgtags	Fri Oct 17 10:09:43 2014 -1000
@@ -437,3 +437,4 @@
 af46576a8d7cb4003028b8ee8bf408cfe227315b jdk9-b32
 9b3f5e4f33725f7c1d9b8e523133fe8383a54d9f jdk9-b33
 821164b0131a47ca065697c7d27d8f215e608c8d jdk9-b34
+438cb613151c4bd290bb732697517cba1cafcb04 jdk9-b35
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ObjectMonitor.java	Fri Oct 17 08:27:46 2014 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/ObjectMonitor.java	Fri Oct 17 10:09:43 2014 -1000
@@ -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
 }
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java	Fri Oct 17 08:27:46 2014 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
 
 }
--- a/make/aix/makefiles/mapfile-vers-debug	Fri Oct 17 08:27:46 2014 +0000
+++ b/make/aix/makefiles/mapfile-vers-debug	Fri Oct 17 10:09:43 2014 -1000
@@ -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,9 +69,8 @@
                 JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
-                JVM_EnableCompiler;
-                JVM_Exit;
                 JVM_FillInStackTrace;
+                JVM_FindClassFromCaller;
                 JVM_FindClassFromClass;
                 JVM_FindClassFromClassLoader;
                 JVM_FindClassFromBootLoader;
@@ -127,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;
@@ -149,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;
@@ -179,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;
@@ -201,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;
 
--- a/make/aix/makefiles/mapfile-vers-product	Fri Oct 17 08:27:46 2014 +0000
+++ b/make/aix/makefiles/mapfile-vers-product	Fri Oct 17 10:09:43 2014 -1000
@@ -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,9 +69,8 @@
                 JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
-                JVM_EnableCompiler;
-                JVM_Exit;
                 JVM_FillInStackTrace;
+                JVM_FindClassFromCaller;
                 JVM_FindClassFromClass;
                 JVM_FindClassFromClassLoader;
                 JVM_FindClassFromBootLoader;
@@ -127,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;
@@ -148,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;
@@ -177,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;
@@ -199,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;
 
--- a/make/bsd/makefiles/mapfile-vers-darwin-debug	Fri Oct 17 08:27:46 2014 +0000
+++ b/make/bsd/makefiles/mapfile-vers-darwin-debug	Fri Oct 17 10:09:43 2014 -1000
@@ -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,9 +67,8 @@
                 _JVM_DTraceDispose
                 _JVM_DumpAllStacks
                 _JVM_DumpThreads
-                _JVM_EnableCompiler
-                _JVM_Exit
                 _JVM_FillInStackTrace
+                _JVM_FindClassFromCaller
                 _JVM_FindClassFromClass
                 _JVM_FindClassFromClassLoader
                 _JVM_FindClassFromBootLoader
@@ -125,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
@@ -147,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
@@ -177,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
@@ -199,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
 
--- a/make/bsd/makefiles/mapfile-vers-darwin-product	Fri Oct 17 08:27:46 2014 +0000
+++ b/make/bsd/makefiles/mapfile-vers-darwin-product	Fri Oct 17 10:09:43 2014 -1000
@@ -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,9 +67,8 @@
                 _JVM_DTraceDispose
                 _JVM_DumpAllStacks
                 _JVM_DumpThreads
-                _JVM_EnableCompiler
-                _JVM_Exit
                 _JVM_FillInStackTrace
+                _JVM_FindClassFromCaller
                 _JVM_FindClassFromClass
                 _JVM_FindClassFromClassLoader
                 _JVM_FindClassFromBootLoader
@@ -125,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
@@ -147,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
@@ -177,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
@@ -199,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
 
--- a/make/bsd/makefiles/mapfile-vers-debug	Fri Oct 17 08:27:46 2014 +0000
+++ b/make/bsd/makefiles/mapfile-vers-debug	Fri Oct 17 10:09:43 2014 -1000
@@ -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,9 +69,8 @@
                 JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
-                JVM_EnableCompiler;
-                JVM_Exit;
                 JVM_FillInStackTrace;
+                JVM_FindClassFromCaller;
                 JVM_FindClassFromClass;
                 JVM_FindClassFromClassLoader;
                 JVM_FindClassFromBootLoader;
@@ -127,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;
@@ -149,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;
@@ -179,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;
@@ -201,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;
 
--- a/make/bsd/makefiles/mapfile-vers-product	Fri Oct 17 08:27:46 2014 +0000
+++ b/make/bsd/makefiles/mapfile-vers-product	Fri Oct 17 10:09:43 2014 -1000
@@ -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,9 +69,8 @@
                 JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
-                JVM_EnableCompiler;
-                JVM_Exit;
                 JVM_FillInStackTrace;
+                JVM_FindClassFromCaller;
                 JVM_FindClassFromClass;
                 JVM_FindClassFromClassLoader;
                 JVM_FindClassFromBootLoader;
@@ -127,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;
@@ -149,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;
@@ -179,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;
@@ -201,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;
 
--- a/make/linux/makefiles/mapfile-vers-debug	Fri Oct 17 08:27:46 2014 +0000
+++ b/make/linux/makefiles/mapfile-vers-debug	Fri Oct 17 10:09:43 2014 -1000
@@ -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,9 +69,8 @@
                 JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
-                JVM_EnableCompiler;
-                JVM_Exit;
                 JVM_FillInStackTrace;
+                JVM_FindClassFromCaller;
                 JVM_FindClassFromClass;
                 JVM_FindClassFromClassLoader;
                 JVM_FindClassFromBootLoader;
@@ -127,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;
@@ -149,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;
@@ -179,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;
@@ -201,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;
 
--- a/make/linux/makefiles/mapfile-vers-product	Fri Oct 17 08:27:46 2014 +0000
+++ b/make/linux/makefiles/mapfile-vers-product	Fri Oct 17 10:09:43 2014 -1000
@@ -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,9 +69,8 @@
                 JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
-                JVM_EnableCompiler;
-                JVM_Exit;
                 JVM_FillInStackTrace;
+                JVM_FindClassFromCaller;
                 JVM_FindClassFromClass;
                 JVM_FindClassFromClassLoader;
                 JVM_FindClassFromBootLoader;
@@ -127,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;
@@ -149,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;
@@ -179,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;
@@ -201,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;
 
--- a/make/solaris/makefiles/mapfile-vers	Fri Oct 17 08:27:46 2014 +0000
+++ b/make/solaris/makefiles/mapfile-vers	Fri Oct 17 10:09:43 2014 -1000
@@ -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,9 +69,8 @@
                 JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
-                JVM_EnableCompiler;
-                JVM_Exit;
                 JVM_FillInStackTrace;
+                JVM_FindClassFromCaller;
                 JVM_FindClassFromClass;
                 JVM_FindClassFromClassLoader;
                 JVM_FindClassFromBootLoader;
@@ -127,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;
@@ -149,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;
@@ -179,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;
@@ -201,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;
 
--- a/make/windows/makefiles/vm.make	Fri Oct 17 08:27:46 2014 +0000
+++ b/make/windows/makefiles/vm.make	Fri Oct 17 10:09:43 2014 -1000
@@ -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"
--- a/src/cpu/sparc/vm/globalDefinitions_sparc.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/cpu/sparc/vm/globalDefinitions_sparc.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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
--- a/src/cpu/x86/vm/globalDefinitions_x86.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/cpu/x86/vm/globalDefinitions_x86.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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
--- a/src/os/aix/vm/os_aix.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/os/aix/vm/os_aix.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
 }
 
--- a/src/os/bsd/dtrace/libjvm_db.c	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/os/bsd/dtrace/libjvm_db.c	Fri Oct 17 10:09:43 2014 -1000
@@ -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) {
--- a/src/os/bsd/vm/os_bsd.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/os/bsd/vm/os_bsd.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
 }
 
--- a/src/os/linux/vm/os_linux.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/os/linux/vm/os_linux.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
 }
 
--- a/src/os/linux/vm/os_linux.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/os/linux/vm/os_linux.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
--- a/src/os/solaris/dtrace/libjvm_db.c	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/os/solaris/dtrace/libjvm_db.c	Fri Oct 17 10:09:43 2014 -1000
@@ -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) {
--- a/src/os/solaris/vm/os_solaris.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/os/solaris/vm/os_solaris.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
 }
 
--- a/src/os/windows/vm/jvm_windows.h	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/os/windows/vm/jvm_windows.h	Fri Oct 17 10:09:43 2014 -1000
@@ -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 */
 
--- a/src/os/windows/vm/os_windows.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/os/windows/vm/os_windows.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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) {
--- a/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java	Fri Oct 17 10:09:43 2014 -1000
@@ -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);
--- a/src/share/vm/classfile/classFileParser.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/classfile/classFileParser.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -2859,6 +2859,11 @@
       "bootstrap_method_index %u has bad constant type in class file %s",
       bootstrap_method_index,
       CHECK);
+
+    guarantee_property((operand_fill_index + 1 + argument_count) < operands->length(),
+      "Invalid BootstrapMethods num_bootstrap_methods or num_bootstrap_arguments value in class file %s",
+      CHECK);
+
     operands->at_put(operand_fill_index++, bootstrap_method_index);
     operands->at_put(operand_fill_index++, argument_count);
 
@@ -2875,8 +2880,6 @@
     }
   }
 
-  assert(ConstantPool::operand_array_length(operands) == attribute_array_length, "correct decode");
-
   u1* current_end = cfs->current();
   guarantee_property(current_end == current_start + attribute_byte_length,
                      "Bad length on BootstrapMethods in class file %s",
--- a/src/share/vm/classfile/classLoader.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/classfile/classLoader.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -75,6 +75,7 @@
 typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
 typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf);
 typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
+typedef jint     (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
 
 static ZipOpen_t         ZipOpen            = NULL;
 static ZipClose_t        ZipClose           = NULL;
@@ -83,6 +84,7 @@
 static ReadMappedEntry_t ReadMappedEntry    = NULL;
 static GetNextEntry_t    GetNextEntry       = NULL;
 static canonicalize_fn_t CanonicalizeEntry  = NULL;
+static Crc32_t           Crc32              = NULL;
 
 // Globals
 
@@ -799,9 +801,11 @@
   ReadEntry    = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry"));
   ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry"));
   GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
+  Crc32        = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
 
   // ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL
-  if (ZipOpen == NULL || FindEntry == NULL || ReadEntry == NULL || GetNextEntry == NULL) {
+  if (ZipOpen == NULL || FindEntry == NULL || ReadEntry == NULL ||
+      GetNextEntry == NULL || Crc32 == NULL) {
     vm_exit_during_initialization("Corrupted ZIP library", path);
   }
 
@@ -811,6 +815,11 @@
   // This lookup only works on 1.3. Do not check for non-null here
 }
 
+int ClassLoader::crc32(int crc, const char* buf, int len) {
+  assert(Crc32 != NULL, "ZIP_CRC32 is not found");
+  return (*Crc32)(crc, (const jbyte*)buf, len);
+}
+
 // PackageInfo data exists in order to support the java.lang.Package
 // class.  A Package object provides information about a java package
 // (version, vendor, etc.) which originates in the manifest of the jar
--- a/src/share/vm/classfile/classLoader.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/classfile/classLoader.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -226,6 +226,7 @@
   // to avoid confusing the zip library
   static bool get_canonical_path(const char* orig, char* out, int len);
  public:
+  static int crc32(int crc, const char* buf, int len);
   static bool update_class_path_entry_list(const char *path,
                                            bool check_for_duplicates,
                                            bool throw_exception=true);
--- a/src/share/vm/classfile/stackMapFrame.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/classfile/stackMapFrame.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -148,7 +148,7 @@
     VerificationType* from, VerificationType* to, int32_t len, TRAPS) const {
   int32_t i = 0;
   for (i = 0; i < len; i++) {
-    if (!to[i].is_assignable_from(from[i], verifier(), THREAD)) {
+    if (!to[i].is_assignable_from(from[i], verifier(), false, THREAD)) {
       break;
     }
   }
@@ -245,7 +245,7 @@
   }
   VerificationType top = _stack[--_stack_size];
   bool subtype = type.is_assignable_from(
-    top, verifier(), CHECK_(VerificationType::bogus_type()));
+    top, verifier(), false, CHECK_(VerificationType::bogus_type()));
   if (!subtype) {
     verifier()->verify_error(
         ErrorContext::bad_type(_offset, stack_top_ctx(),
@@ -265,7 +265,7 @@
     return VerificationType::bogus_type();
   }
   bool subtype = type.is_assignable_from(_locals[index],
-    verifier(), CHECK_(VerificationType::bogus_type()));
+    verifier(), false, CHECK_(VerificationType::bogus_type()));
   if (!subtype) {
     verifier()->verify_error(
         ErrorContext::bad_type(_offset,
@@ -288,14 +288,14 @@
         "get long/double overflows locals");
     return;
   }
-  bool subtype = type1.is_assignable_from(_locals[index], verifier(), CHECK);
+  bool subtype = type1.is_assignable_from(_locals[index], verifier(), false, CHECK);
   if (!subtype) {
     verifier()->verify_error(
         ErrorContext::bad_type(_offset,
             TypeOrigin::local(index, this), TypeOrigin::implicit(type1)),
         "Bad local variable type");
   } else {
-    subtype = type2.is_assignable_from(_locals[index + 1], verifier(), CHECK);
+    subtype = type2.is_assignable_from(_locals[index + 1], verifier(), false, CHECK);
     if (!subtype) {
       /* Unreachable? All local store routines convert a split long or double
        * into a TOP during the store.  So we should never end up seeing an
--- a/src/share/vm/classfile/stackMapFrame.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/classfile/stackMapFrame.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -234,7 +234,7 @@
     if (_stack_size != 0) {
       VerificationType top = _stack[_stack_size - 1];
       bool subtype = type.is_assignable_from(
-        top, verifier(), CHECK_(VerificationType::bogus_type()));
+        top, verifier(), false, CHECK_(VerificationType::bogus_type()));
       if (subtype) {
         --_stack_size;
         return top;
@@ -249,9 +249,9 @@
     assert(type2.is_long() || type2.is_double(), "must be long/double_2");
     if (_stack_size >= 2) {
       VerificationType top1 = _stack[_stack_size - 1];
-      bool subtype1 = type1.is_assignable_from(top1, verifier(), CHECK);
+      bool subtype1 = type1.is_assignable_from(top1, verifier(), false, CHECK);
       VerificationType top2 = _stack[_stack_size - 2];
-      bool subtype2 = type2.is_assignable_from(top2, verifier(), CHECK);
+      bool subtype2 = type2.is_assignable_from(top2, verifier(), false, CHECK);
       if (subtype1 && subtype2) {
         _stack_size -= 2;
         return;
--- a/src/share/vm/classfile/verificationType.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/classfile/verificationType.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -42,7 +42,8 @@
 }
 
 bool VerificationType::is_reference_assignable_from(
-    const VerificationType& from, ClassVerifier* context, TRAPS) const {
+    const VerificationType& from, ClassVerifier* context,
+    bool from_field_is_protected, TRAPS) const {
   instanceKlassHandle klass = context->current_class();
   if (from.is_null()) {
     // null is assignable to any reference
@@ -62,9 +63,11 @@
         Handle(THREAD, klass->protection_domain()), true, CHECK_false);
     KlassHandle this_class(THREAD, obj);
 
-    if (this_class->is_interface()) {
-      // We treat interfaces as java.lang.Object, including
-      // java.lang.Cloneable and java.io.Serializable
+    if (this_class->is_interface() && (!from_field_is_protected ||
+        from.name() != vmSymbols::java_lang_Object())) {
+      // If we are not trying to access a protected field or method in
+      // java.lang.Object then we treat interfaces as java.lang.Object,
+      // including java.lang.Cloneable and java.io.Serializable.
       return true;
     } else if (from.is_object()) {
       Klass* from_class = SystemDictionary::resolve_or_fail(
@@ -76,7 +79,8 @@
     VerificationType comp_this = get_component(context, CHECK_false);
     VerificationType comp_from = from.get_component(context, CHECK_false);
     if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
-      return comp_this.is_assignable_from(comp_from, context, CHECK_false);
+      return comp_this.is_assignable_from(comp_from, context,
+                                          from_field_is_protected, CHECK_false);
     }
   }
   return false;
--- a/src/share/vm/classfile/verificationType.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/classfile/verificationType.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -265,7 +265,8 @@
   // is assignable to another.  Returns true if one can assign 'from' to
   // this.
   bool is_assignable_from(
-      const VerificationType& from, ClassVerifier* context, TRAPS) const {
+      const VerificationType& from, ClassVerifier* context,
+      bool from_field_is_protected, TRAPS) const {
     if (equals(from) || is_bogus()) {
       return true;
     } else {
@@ -286,7 +287,9 @@
           return from.is_integer();
         default:
           if (is_reference() && from.is_reference()) {
-            return is_reference_assignable_from(from, context, CHECK_false);
+            return is_reference_assignable_from(from, context,
+                                                from_field_is_protected,
+                                                CHECK_false);
           } else {
             return false;
           }
@@ -308,7 +311,8 @@
  private:
 
   bool is_reference_assignable_from(
-    const VerificationType&, ClassVerifier*, TRAPS) const;
+    const VerificationType&, ClassVerifier*, bool from_field_is_protected,
+    TRAPS) const;
 };
 
 #endif // SHARE_VM_CLASSFILE_VERIFICATIONTYPE_HPP
--- a/src/share/vm/classfile/verifier.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/classfile/verifier.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
   }
@@ -1721,7 +1734,7 @@
       VerificationType throwable =
         VerificationType::reference_type(vmSymbols::java_lang_Throwable());
       bool is_subclass = throwable.is_assignable_from(
-        catch_type, this, CHECK_VERIFY(this));
+        catch_type, this, false, CHECK_VERIFY(this));
       if (!is_subclass) {
         // 4286534: should throw VerifyError according to recent spec change
         verify_error(ErrorContext::bad_type(handler_pc,
@@ -2174,7 +2187,7 @@
         stack_object_type = current_type();
       }
       is_assignable = target_class_type.is_assignable_from(
-        stack_object_type, this, CHECK_VERIFY(this));
+        stack_object_type, this, false, CHECK_VERIFY(this));
       if (!is_assignable) {
         verify_error(ErrorContext::bad_type(bci,
             current_frame->stack_top_ctx(),
@@ -2201,7 +2214,7 @@
         // It's protected access, check if stack object is assignable to
         // current class.
         is_assignable = current_type().is_assignable_from(
-          stack_object_type, this, CHECK_VERIFY(this));
+          stack_object_type, this, true, CHECK_VERIFY(this));
         if (!is_assignable) {
           verify_error(ErrorContext::bad_type(bci,
               current_frame->stack_top_ctx(),
@@ -2475,7 +2488,7 @@
         instanceKlassHandle mh(THREAD, m->method_holder());
         if (m->is_protected() && !mh->is_same_class_package(_klass())) {
           bool assignable = current_type().is_assignable_from(
-            objectref_type, this, CHECK_VERIFY(this));
+            objectref_type, this, true, CHECK_VERIFY(this));
           if (!assignable) {
             verify_error(ErrorContext::bad_type(bci,
                 TypeOrigin::cp(new_class_index, objectref_type),
@@ -2646,11 +2659,11 @@
     bool have_imr_indirect = cp->tag_at(index).value() == JVM_CONSTANT_InterfaceMethodref;
     if (!current_class()->is_anonymous()) {
       subtype = ref_class_type.is_assignable_from(
-                 current_type(), this, CHECK_VERIFY(this));
+                 current_type(), this, false, CHECK_VERIFY(this));
     } else {
       VerificationType host_klass_type =
                         VerificationType::reference_type(current_class()->host_klass()->name());
-      subtype = ref_class_type.is_assignable_from(host_klass_type, this, CHECK_VERIFY(this));
+      subtype = ref_class_type.is_assignable_from(host_klass_type, this, false, CHECK_VERIFY(this));
 
       // If invokespecial of IMR, need to recheck for same or
       // direct interface relative to the host class
@@ -2694,7 +2707,7 @@
           VerificationType top = current_frame->pop_stack(CHECK_VERIFY(this));
           VerificationType hosttype =
             VerificationType::reference_type(current_class()->host_klass()->name());
-          bool subtype = hosttype.is_assignable_from(top, this, CHECK_VERIFY(this));
+          bool subtype = hosttype.is_assignable_from(top, this, false, CHECK_VERIFY(this));
           if (!subtype) {
             verify_error( ErrorContext::bad_type(current_frame->offset(),
               current_frame->stack_top_ctx(),
@@ -2719,7 +2732,7 @@
               // It's protected access, check if stack object is
               // assignable to current class.
               bool is_assignable = current_type().is_assignable_from(
-                stack_object_type, this, CHECK_VERIFY(this));
+                stack_object_type, this, true, CHECK_VERIFY(this));
               if (!is_assignable) {
                 if (ref_class_type.name() == vmSymbols::java_lang_Object()
                     && stack_object_type.is_array()
@@ -2902,7 +2915,7 @@
         "Method expects a return value");
     return;
   }
-  bool match = return_type.is_assignable_from(type, this, CHECK_VERIFY(this));
+  bool match = return_type.is_assignable_from(type, this, false, CHECK_VERIFY(this));
   if (!match) {
     verify_error(ErrorContext::bad_type(bci,
         current_frame->stack_top_ctx(), TypeOrigin::signature(return_type)),
--- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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);
--- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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 {
--- a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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
--- a/src/share/vm/gc_implementation/g1/g1CardCounts.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/g1/g1CardCounts.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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);
 }
--- a/src/share/vm/gc_implementation/g1/g1CardCounts.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/g1/g1CardCounts.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
   }
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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 {
--- a/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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);
   }
 }
 
--- a/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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(); }
 
--- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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);
 }
--- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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.
--- a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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());
--- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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);
   }
 }
 
--- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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
--- a/src/share/vm/interpreter/linkResolver.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/interpreter/linkResolver.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -246,6 +246,12 @@
   // Ignore overpasses so statics can be found during resolution
   Method* result_oop = klass->uncached_lookup_method(name, signature, Klass::skip_overpass);
 
+  if (klass->oop_is_array()) {
+    // Only consider klass and super klass for arrays
+    result = methodHandle(THREAD, result_oop);
+    return;
+  }
+
   // JDK 8, JVMS 5.4.3.4: Interface method resolution should
   // ignore static and non-public methods of java.lang.Object,
   // like clone, finalize, registerNatives.
@@ -290,6 +296,11 @@
     result = methodHandle(THREAD, super_klass->uncached_lookup_method(name, signature, Klass::normal));
   }
 
+  if (klass->oop_is_array()) {
+    // Only consider klass and super klass for arrays
+    return;
+  }
+
   if (result.is_null()) {
     Array<Method*>* default_methods = InstanceKlass::cast(klass())->default_methods();
     if (default_methods != NULL) {
@@ -545,7 +556,7 @@
   // 2. lookup method in resolved klass and its super klasses
   lookup_method_in_klasses(resolved_method, resolved_klass, method_name, method_signature, true, false, CHECK);
 
-  if (resolved_method.is_null()) { // not found in the class hierarchy
+  if (resolved_method.is_null() && !resolved_klass->oop_is_array()) { // not found in the class hierarchy
     // 3. lookup method in all the interfaces implemented by the resolved klass
     lookup_method_in_interfaces(resolved_method, resolved_klass, method_name, method_signature, CHECK);
 
@@ -558,16 +569,16 @@
         CLEAR_PENDING_EXCEPTION;
       }
     }
+  }
 
-    if (resolved_method.is_null()) {
-      // 4. method lookup failed
-      ResourceMark rm(THREAD);
-      THROW_MSG_CAUSE(vmSymbols::java_lang_NoSuchMethodError(),
-                      Method::name_and_sig_as_C_string(resolved_klass(),
-                                                              method_name,
-                                                              method_signature),
-                      nested_exception);
-    }
+  if (resolved_method.is_null()) {
+    // 4. method lookup failed
+    ResourceMark rm(THREAD);
+    THROW_MSG_CAUSE(vmSymbols::java_lang_NoSuchMethodError(),
+                    Method::name_and_sig_as_C_string(resolved_klass(),
+                                                            method_name,
+                                                            method_signature),
+                    nested_exception);
   }
 
   // 5. access checks, access checking may be turned off when calling from within the VM.
@@ -633,17 +644,18 @@
   // JDK8: also look for static methods
   lookup_method_in_klasses(resolved_method, resolved_klass, method_name, method_signature, false, true, CHECK);
 
-  if (resolved_method.is_null()) {
+  if (resolved_method.is_null() && !resolved_klass->oop_is_array()) {
     // lookup method in all the super-interfaces
     lookup_method_in_interfaces(resolved_method, resolved_klass, method_name, method_signature, CHECK);
-    if (resolved_method.is_null()) {
-      // no method found
-      ResourceMark rm(THREAD);
-      THROW_MSG(vmSymbols::java_lang_NoSuchMethodError(),
-                Method::name_and_sig_as_C_string(resolved_klass(),
-                                                        method_name,
-                                                        method_signature));
-    }
+  }
+
+  if (resolved_method.is_null()) {
+    // no method found
+    ResourceMark rm(THREAD);
+    THROW_MSG(vmSymbols::java_lang_NoSuchMethodError(),
+              Method::name_and_sig_as_C_string(resolved_klass(),
+                                                      method_name,
+                                                      method_signature));
   }
 
   if (check_access) {
@@ -775,7 +787,7 @@
   }
 
   // Resolve instance field
-  KlassHandle sel_klass(THREAD, InstanceKlass::cast(resolved_klass())->find_field(field, sig, &fd));
+  KlassHandle sel_klass(THREAD, resolved_klass->find_field(field, sig, &fd));
   // check if field exists; i.e., if a klass containing the field def has been selected
   if (sel_klass.is_null()) {
     ResourceMark rm(THREAD);
--- a/src/share/vm/memory/filemap.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/memory/filemap.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -331,6 +331,14 @@
     return false;
   }
 
+  size_t len = lseek(fd, 0, SEEK_END);
+  struct FileMapInfo::FileMapHeader::space_info* si =
+    &_header->_space[MetaspaceShared::mc];
+  if (si->_file_offset >= len || len - si->_file_offset < si->_used) {
+    fail_continue("The shared archive file has been truncated.");
+    return false;
+  }
+
   _file_offset += (long)n;
   return true;
 }
@@ -431,6 +439,7 @@
   si->_capacity = capacity;
   si->_read_only = read_only;
   si->_allow_exec = allow_exec;
+  si->_crc = ClassLoader::crc32(0, base, (jint)size);
   write_bytes_aligned(base, (int)size);
 }
 
@@ -455,14 +464,15 @@
 // Align file position to an allocation unit boundary.
 
 void FileMapInfo::align_file_position() {
-  long new_file_offset = align_size_up(_file_offset, os::vm_allocation_granularity());
+  size_t new_file_offset = align_size_up(_file_offset,
+                                         os::vm_allocation_granularity());
   if (new_file_offset != _file_offset) {
     _file_offset = new_file_offset;
     if (_file_open) {
       // Seek one byte back from the target and write a byte to insure
       // that the written file is the correct length.
       _file_offset -= 1;
-      if (lseek(_fd, _file_offset, SEEK_SET) < 0) {
+      if (lseek(_fd, (long)_file_offset, SEEK_SET) < 0) {
         fail_stop("Unable to seek.");
       }
       char zero = 0;
@@ -569,6 +579,19 @@
   return base;
 }
 
+bool FileMapInfo::verify_region_checksum(int i) {
+  if (!VerifySharedSpaces) {
+    return true;
+  }
+  const char* buf = _header->_space[i]._base;
+  size_t sz = _header->_space[i]._used;
+  int crc = ClassLoader::crc32(0, buf, (jint)sz);
+  if (crc != _header->_space[i]._crc) {
+    fail_continue("Checksum verification failed.");
+    return false;
+  }
+  return true;
+}
 
 // Unmap a memory region in the address space.
 
@@ -629,7 +652,21 @@
   return true;
 }
 
+int FileMapInfo::FileMapHeader::compute_crc() {
+  char* header = data();
+  // start computing from the field after _crc
+  char* buf = (char*)&_crc + sizeof(int);
+  size_t sz = data_size() - (buf - header);
+  int crc = ClassLoader::crc32(0, buf, (jint)sz);
+  return crc;
+}
+
 bool FileMapInfo::FileMapHeader::validate() {
+  if (VerifySharedSpaces && compute_crc() != _crc) {
+    fail_continue("Header checksum verification failed.");
+    return false;
+  }
+
   if (_version != current_version()) {
     FileMapInfo::fail_continue("The shared archive file is the wrong version.");
     return false;
--- a/src/share/vm/memory/filemap.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/memory/filemap.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -61,7 +61,7 @@
 
   bool  _file_open;
   int   _fd;
-  long  _file_offset;
+  size_t  _file_offset;
 
 private:
   static SharedClassPathEntry* _classpath_entry_table;
@@ -87,12 +87,14 @@
     }
 
     int    _magic;                    // identify file type.
+    int    _crc;                      // header crc checksum.
     int    _version;                  // (from enum, above.)
     size_t _alignment;                // how shared archive should be aligned
     int    _obj_alignment;            // value of ObjectAlignmentInBytes
 
     struct space_info {
-      int    _file_offset;   // sizeof(this) rounded to vm page size
+      int    _crc;           // crc checksum of the current space
+      size_t _file_offset;   // sizeof(this) rounded to vm page size
       char*  _base;          // copy-on-write base address
       size_t _capacity;      // for validity checking
       size_t _used;          // for setting space top on read
@@ -135,6 +137,7 @@
 
     virtual bool validate();
     virtual void populate(FileMapInfo* info, size_t alignment);
+    int compute_crc();
   };
 
   FileMapHeader * _header;
@@ -153,6 +156,8 @@
   ~FileMapInfo();
 
   static int current_version()        { return _current_version; }
+  int    compute_header_crc()         { return _header->compute_crc(); }
+  void   set_header_crc(int crc)      { _header->_crc = crc; }
   void   populate_header(size_t alignment);
   bool   validate_header();
   void   invalidate();
@@ -181,6 +186,7 @@
   void  write_bytes_aligned(const void* buffer, int count);
   char* map_region(int i);
   void  unmap_region(int i);
+  bool  verify_region_checksum(int i);
   void  close();
   bool  is_open() { return _file_open; }
   ReservedSpace reserve_shared_memory();
--- a/src/share/vm/memory/metaspaceShared.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/memory/metaspaceShared.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -608,6 +608,7 @@
 
   // Pass 2 - write data.
   mapinfo->open_for_write();
+  mapinfo->set_header_crc(mapinfo->compute_header_crc());
   mapinfo->write_header();
   mapinfo->write_space(MetaspaceShared::ro, _loader_data->ro_metaspace(), true);
   mapinfo->write_space(MetaspaceShared::rw, _loader_data->rw_metaspace(), false);
@@ -937,9 +938,13 @@
 
   // Map each shared region
   if ((_ro_base = mapinfo->map_region(ro)) != NULL &&
+       mapinfo->verify_region_checksum(ro) &&
       (_rw_base = mapinfo->map_region(rw)) != NULL &&
+       mapinfo->verify_region_checksum(rw) &&
       (_md_base = mapinfo->map_region(md)) != NULL &&
+       mapinfo->verify_region_checksum(md) &&
       (_mc_base = mapinfo->map_region(mc)) != NULL &&
+       mapinfo->verify_region_checksum(mc) &&
       (image_alignment == (size_t)max_alignment()) &&
       mapinfo->validate_classpath_entry_table()) {
     // Success (no need to do anything)
--- a/src/share/vm/memory/padded.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/memory/padded.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -76,10 +76,16 @@
 // if the start address is a multiple of alignment.
 template <class T, size_t alignment = DEFAULT_CACHE_LINE_SIZE>
 class PaddedEnd : public PaddedEndImpl<T, PADDED_END_SIZE(T, alignment)> {
-  // 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<T> objects. All elements will
 // start at a multiple of alignment and the size will be aligned to alignment.
 template <class T, MEMFLAGS flags, size_t alignment = DEFAULT_CACHE_LINE_SIZE>
--- a/src/share/vm/oops/arrayKlass.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/oops/arrayKlass.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -64,6 +64,13 @@
   return NULL;
 }
 
+// find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
+Klass* ArrayKlass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
+  // There are no fields in an array klass but look to the super class (Object)
+  assert(super(), "super klass must be present");
+  return super()->find_field(name, sig, fd);
+}
+
 Method* ArrayKlass::uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const {
   // There are no methods in an array klass but the super class (Object) has some
   assert(super(), "super klass must be present");
--- a/src/share/vm/oops/arrayKlass.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/oops/arrayKlass.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -28,6 +28,7 @@
 #include "memory/universe.hpp"
 #include "oops/klass.hpp"
 
+class fieldDescriptor;
 class klassVtable;
 
 // ArrayKlass is the abstract baseclass for all array classes
@@ -77,6 +78,9 @@
   virtual oop multi_allocate(int rank, jint* sizes, TRAPS);
   objArrayOop allocate_arrayArray(int n, int length, TRAPS);
 
+  // find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
+  Klass* find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
+
   // Lookup operations
   Method* uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const;
 
--- a/src/share/vm/oops/klass.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/oops/klass.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -130,6 +130,15 @@
   return is_subclass_of(k);
 }
 
+Klass* Klass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
+#ifdef ASSERT
+  tty->print_cr("Error: find_field called on a klass oop."
+                " Likely error: reflection method does not correctly"
+                " wrap return value in a mirror object.");
+#endif
+  ShouldNotReachHere();
+  return NULL;
+}
 
 Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const {
 #ifdef ASSERT
--- a/src/share/vm/oops/klass.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/oops/klass.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -62,6 +62,7 @@
 class klassVtable;
 class ParCompactionManager;
 class KlassSizeStats;
+class fieldDescriptor;
 
 class Klass : public Metadata {
   friend class VMStructs;
@@ -411,6 +412,7 @@
   virtual void initialize(TRAPS);
   // lookup operation for MethodLookupCache
   friend class MethodLookupCache;
+  virtual Klass* find_field(Symbol* name, Symbol* signature, fieldDescriptor* fd) const;
   virtual Method* uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const;
  public:
   Method* lookup_method(Symbol* name, Symbol* signature) const {
--- a/src/share/vm/opto/graphKit.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/opto/graphKit.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
--- a/src/share/vm/opto/graphKit.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/opto/graphKit.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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);
--- a/src/share/vm/prims/jvm.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/prims/jvm.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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.
 //
@@ -805,6 +721,7 @@
   return (jclass) JNIHandles::make_local(env, k->java_mirror());
 JVM_END
 
+// Not used; JVM_FindClassFromCaller replaces this.
 JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name,
                                                jboolean init, jobject loader,
                                                jboolean throwError))
@@ -831,6 +748,42 @@
   return result;
 JVM_END
 
+// Find a class with this name in this loader, using the caller's protection domain.
+JVM_ENTRY(jclass, JVM_FindClassFromCaller(JNIEnv* env, const char* name,
+                                          jboolean init, jobject loader,
+                                          jclass caller))
+  JVMWrapper2("JVM_FindClassFromCaller %s throws ClassNotFoundException", name);
+  // Java libraries should ensure that name is never null...
+  if (name == NULL || (int)strlen(name) > Symbol::max_length()) {
+    // It's impossible to create this class;  the name cannot fit
+    // into the constant pool.
+    THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), name);
+  }
+
+  TempNewSymbol h_name = SymbolTable::new_symbol(name, CHECK_NULL);
+
+  oop loader_oop = JNIHandles::resolve(loader);
+  oop from_class = JNIHandles::resolve(caller);
+  oop protection_domain = NULL;
+  // If loader is null, shouldn't call ClassLoader.checkPackageAccess; otherwise get
+  // NPE. Put it in another way, the bootstrap class loader has all permission and
+  // thus no checkPackageAccess equivalence in the VM class loader.
+  // The caller is also passed as NULL by the java code if there is no security
+  // manager to avoid the performance cost of getting the calling class.
+  if (from_class != NULL && loader_oop != NULL) {
+    protection_domain = java_lang_Class::as_Klass(from_class)->protection_domain();
+  }
+
+  Handle h_loader(THREAD, loader_oop);
+  Handle h_prot(THREAD, protection_domain);
+  jclass result = find_class_from_class_loader(env, h_name, init, 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
 
 JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name,
                                          jboolean init, jclass from))
@@ -1614,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
 
@@ -1652,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))
@@ -2680,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" {
 
@@ -3422,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.
 
@@ -3527,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 ///////////////////////////////////////////////////////////////////////////////////////////
 
 
@@ -3676,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))
@@ -3854,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))
@@ -3921,10 +3457,15 @@
 
 // Shared JNI/JVM entry points //////////////////////////////////////////////////////////////
 
-jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, Handle loader, Handle protection_domain, jboolean throwError, TRAPS) {
+jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init,
+                                    Handle loader, Handle protection_domain,
+                                    jboolean throwError, TRAPS) {
   // Security Note:
   //   The Java level wrapper will perform the necessary security check allowing
-  //   us to pass the NULL as the initiating class loader.
+  //   us to pass the NULL as the initiating class loader.  The VM is responsible for
+  //   the checkPackageAccess relative to the initiating class loader via the
+  //   protection_domain. The protection_domain is passed as NULL by the java code
+  //   if there is no security manager in 3-arg Class.forName().
   Klass* klass = SystemDictionary::resolve_or_fail(name, loader, protection_domain, throwError != 0, CHECK_NULL);
 
   KlassHandle klass_handle(THREAD, klass);
@@ -3982,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))
@@ -4150,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);
--- a/src/share/vm/prims/jvm.h	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/prims/jvm.h	Fri Oct 17 10:09:43 2014 -1000
@@ -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.
@@ -420,6 +350,19 @@
 JVM_FindClassFromBootLoader(JNIEnv *env, const char *name);
 
 /*
+ * Find a class from a given class loader.  Throws ClassNotFoundException.
+ *  name:   name of class
+ *  init:   whether initialization is done
+ *  loader: class loader to look up the class. This may not be the same as the caller's
+ *          class loader.
+ *  caller: initiating class. The initiating class may be null when a security
+ *          manager is not installed.
+ */
+JNIEXPORT jclass JNICALL
+JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init,
+                        jobject loader, jclass caller);
+
+/*
  * Find a class from a given class.
  */
 JNIEXPORT jclass JNICALL
@@ -499,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
@@ -647,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
  */
@@ -1230,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
@@ -1276,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?
  */
@@ -1496,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
--- a/src/share/vm/prims/jvmtiEnvBase.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/prims/jvmtiEnvBase.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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
--- a/src/share/vm/prims/whitebox.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/prims/whitebox.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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",
--- a/src/share/vm/runtime/arguments.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/arguments.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -3782,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++) {
@@ -3879,6 +3881,11 @@
     return JNI_ENOMEM;
   }
 
+  // Set up VerifySharedSpaces
+  if (FLAG_IS_DEFAULT(VerifySharedSpaces) && SharedArchiveFile != NULL) {
+    VerifySharedSpaces = true;
+  }
+
   // Delay warning until here so that we've had a chance to process
   // the -XX:-PrintWarnings flag
   if (needs_hotspotrc_warning) {
--- a/src/share/vm/runtime/arguments_ext.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/arguments_ext.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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() {
--- a/src/share/vm/runtime/globals.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/globals.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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 {
--- a/src/share/vm/runtime/globals.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/globals.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
 
@@ -1177,11 +1179,11 @@
           "When true prevents OS-level spurious, or premature, wakeups "    \
           "from Object.wait (Ignored for Windows)")                         \
                                                                             \
-  product(intx, NativeMonitorTimeout, -1, "(Unstable)")                     \
-                                                                            \
-  product(intx, NativeMonitorFlags, 0, "(Unstable)")                        \
-                                                                            \
-  product(intx, NativeMonitorSpinLimit, 20, "(Unstable)")                   \
+  experimental(intx, NativeMonitorTimeout, -1, "(Unstable)")                \
+                                                                            \
+  experimental(intx, NativeMonitorFlags, 0, "(Unstable)")                   \
+                                                                            \
+  experimental(intx, NativeMonitorSpinLimit, 20, "(Unstable)")              \
                                                                             \
   develop(bool, UsePthreads, false,                                         \
           "Use pthread-based instead of libthread-based synchronization "   \
@@ -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")                  \
@@ -3794,6 +3799,10 @@
   product(bool, UseSharedSpaces, true,                                      \
           "Use shared spaces for metadata")                                 \
                                                                             \
+  product(bool, VerifySharedSpaces, false,                                  \
+          "Verify shared spaces (false for default archive, true for "      \
+          "archive specified by -XX:SharedArchiveFile)")                    \
+                                                                            \
   product(bool, RequireSharedSpaces, false,                                 \
           "Require shared spaces for metadata")                             \
                                                                             \
--- a/src/share/vm/runtime/java.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/java.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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<mtInternal> {
- 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();
--- a/src/share/vm/runtime/java.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/java.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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);
 
--- a/src/share/vm/runtime/javaCalls.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/javaCalls.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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) {
--- a/src/share/vm/runtime/javaCalls.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/javaCalls.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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
--- a/src/share/vm/runtime/objectMonitor.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/objectMonitor.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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<ObjectMonitor>)=" SIZE_FORMAT,
+                  sizeof(PaddedEnd<ObjectMonitor>));
   }
 
   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<ObjectMonitor>) % cache_line_size) != 0) {
+      tty->print_cr("WARNING: PaddedEnd<ObjectMonitor> size is not a "
+                    "multiple of a cache line which permits false sharing.");
       warning_cnt++;
     }
   }
--- a/src/share/vm/runtime/objectMonitor.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/objectMonitor.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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().
 //
-// 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
-
+// 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 _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
+//     <lightly_used_fields>
+//     <optional padding>
+//     _owner
+//     <remaining_fields>
+// - The VM assumes write ordering and machine word alignment with
+//   respect to the _owner field and the <remaining_fields> 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 <remaining_fields> 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 <remaining_fields>:
+//     _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
--- a/src/share/vm/runtime/objectMonitor.inline.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/objectMonitor.inline.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
 }
 
--- a/src/share/vm/runtime/reflection.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/reflection.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -507,7 +507,8 @@
   if (access.is_protected()) {
     if (!protected_restriction) {
       // See if current_class (or outermost host class) is a subclass of field_class
-      if (host_class->is_subclass_of(field_class)) {
+      // An interface may not access protected members of j.l.Object
+      if (!host_class->is_interface() && host_class->is_subclass_of(field_class)) {
         if (access.is_static() || // static fields are ok, see 6622385
             current_class == resolved_class ||
             field_class == resolved_class ||
--- a/src/share/vm/runtime/synchronizer.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/synchronizer.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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<ObjectMonitor> *, 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<ObjectMonitor> * block = (PaddedEnd<ObjectMonitor> *)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<ObjectMonitor> *) 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<ObjectMonitor> * block =
+       (PaddedEnd<ObjectMonitor> *)gBlockList; block != NULL;
+       block = (PaddedEnd<ObjectMonitor> *)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<ObjectMonitor>) * _BLOCKSIZE;
+    PaddedEnd<ObjectMonitor> * 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<ObjectMonitor> *)
+             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<ObjectMonitor> * block =
+              (PaddedEnd<ObjectMonitor> *)gBlockList; block != NULL;
+              block = (PaddedEnd<ObjectMonitor> *)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<ObjectMonitor> * block = (PaddedEnd<ObjectMonitor> *)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<ObjectMonitor> *) 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<ObjectMonitor> * block = (PaddedEnd<ObjectMonitor> *)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<ObjectMonitor>)) == 0, "check");
       return 1;
     }
-    block = (ObjectMonitor*) block->FreeNext;
+    block = (PaddedEnd<ObjectMonitor> *) block->FreeNext;
   }
   return 0;
 }
--- a/src/share/vm/runtime/synchronizer.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/synchronizer.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -134,6 +134,8 @@
 
  private:
   enum { _BLOCKSIZE = 128 };
+  // gBlockList is really PaddedEnd<ObjectMonitor> *, 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,
--- a/src/share/vm/runtime/thread.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/thread.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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");
--- a/src/share/vm/runtime/vmStructs.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/vmStructs.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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) */                                                 \
   /*********************/                                                 \
--- a/src/share/vm/runtime/vmThread.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/runtime/vmThread.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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
--- a/src/share/vm/services/mallocTracker.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/services/mallocTracker.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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();
   }
--- a/src/share/vm/services/mallocTracker.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/services/mallocTracker.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
   }
--- a/src/share/vm/services/memBaseline.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/services/memBaseline.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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();
--- a/src/share/vm/services/memReporter.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/services/memReporter.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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),
--- a/src/share/vm/services/memTracker.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/services/memTracker.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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();
+    }
   }
 }
 
--- a/src/share/vm/services/memTracker.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/services/memTracker.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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
--- a/src/share/vm/services/virtualMemoryTracker.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/services/virtualMemoryTracker.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -443,26 +443,28 @@
 bool VirtualMemoryTracker::walk_virtual_memory(VirtualMemoryWalker* walker) {
   assert(_reserved_regions != NULL, "Sanity check");
   ThreadCritical tc;
-  LinkedListNode<ReservedMemoryRegion>* 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<ReservedMemoryRegion>* 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;
--- a/src/share/vm/services/virtualMemoryTracker.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/services/virtualMemoryTracker.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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;
   }
--- a/src/share/vm/utilities/globalDefinitions.hpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/utilities/globalDefinitions.hpp	Fri Oct 17 10:09:43 2014 -1000
@@ -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
 
 
 //----------------------------------------------------------------------------------------------------
--- a/src/share/vm/utilities/vmError.cpp	Fri Oct 17 08:27:46 2014 +0000
+++ b/src/share/vm/utilities/vmError.cpp	Fri Oct 17 10:09:43 2014 -1000
@@ -740,7 +740,7 @@
 
   STEP(228, "(Native Memory Tracking)" )
      if (_verbose) {
-       MemTracker::final_report(st);
+       MemTracker::error_report(st);
      }
 
   STEP(230, "" )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/g1/TestG1TraceReclaimDeadHumongousObjectsAtYoungGC.java	Fri Oct 17 10:09:43 2014 -1000
@@ -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<Object> garbageList = new LinkedList<Object>();
+    // 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");
+    }
+  }
+}
--- a/test/gc/g1/TestSummarizeRSetStatsThreads.java	Fri Oct 17 08:27:46 2014 +0000
+++ b/test/gc/g1/TestSummarizeRSetStatsThreads.java	Fri Oct 17 10:09:43 2014 -1000
@@ -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);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/NMT/ChangeTrackingLevel.java	Fri Oct 17 10:09:43 2014 -1000
@@ -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");
+        }
+    }
+};
--- a/test/runtime/NMT/PrintNMTStatistics.java	Fri Oct 17 08:27:46 2014 +0000
+++ b/test/runtime/NMT/PrintNMTStatistics.java	Fri Oct 17 10:09:43 2014 -1000
@@ -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 = new OutputAnalyzer(pb.start());
-    output.shouldContain("Java Heap (reserved=");
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
-  }
+    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);
+
+    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);
+    }
 }
--- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Fri Oct 17 08:27:46 2014 +0000
+++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Fri Oct 17 10:09:43 2014 -1000
@@ -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();