Merge
authorlana
Wed, 09 Jul 2014 10:42:04 -0700
changeset 25083 6702f17e734e
parent 25049 bb3367df6c09 (current diff)
parent 25082 3cbc57e90038 (diff)
child 25084 ee25b5c2dbf1
Merge
--- a/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #import <Foundation/Foundation.h>
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
 
-#include <JavaVM/jni.h>
+#include <jni.h>
 
 #import <mach/mach.h>
 #import <mach/mach_types.h>
--- a/hotspot/agent/src/os/bsd/Makefile	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/agent/src/os/bsd/Makefile	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -50,9 +50,9 @@
 	ps_core.c
 OBJS    = $(SOURCES:.c=.o)
 OBJSPLUS = MacosxDebuggerLocal.o sadis.o $(OBJS)
-EXTINCLUDE = -I/System/Library/Frameworks/JavaVM.framework/Headers -I.
+EXTINCLUDE = -I.
 EXTCFLAGS = -m64 -D__APPLE__ -framework JavaNativeFoundation
-FOUNDATIONFLAGS = -framework Foundation -F/System/Library/Frameworks/JavaVM.framework/Frameworks -framework JavaNativeFoundation -framework Security -framework CoreFoundation
+FOUNDATIONFLAGS = -framework Foundation -framework JavaNativeFoundation -framework Security -framework CoreFoundation
 LIBSA = $(ARCH)/libsaproc.dylib
 endif   # Darwin
 
--- a/hotspot/agent/src/os/linux/libproc.h	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/agent/src/os/linux/libproc.h	Wed Jul 09 10:42:04 2014 -0700
@@ -34,7 +34,7 @@
 #include "libproc_md.h"
 #endif
 
-#include <linux/ptrace.h>
+#include <sys/ptrace.h>
 
 /************************************************************************************
 
--- a/hotspot/agent/src/os/linux/ps_proc.c	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/agent/src/os/linux/ps_proc.c	Wed Jul 09 10:42:04 2014 -0700
@@ -263,7 +263,7 @@
 
 static bool read_lib_info(struct ps_prochandle* ph) {
   char fname[32];
-  char buf[256];
+  char buf[PATH_MAX];
   FILE *fp = NULL;
 
   sprintf(fname, "/proc/%d/maps", ph->pid);
@@ -273,10 +273,41 @@
     return false;
   }
 
-  while(fgets_no_cr(buf, 256, fp)){
-    char * word[6];
-    int nwords = split_n_str(buf, 6, word, ' ', '\0');
-    if (nwords > 5 && find_lib(ph, word[5]) == false) {
+  while(fgets_no_cr(buf, PATH_MAX, fp)){
+    char * word[7];
+    int nwords = split_n_str(buf, 7, word, ' ', '\0');
+
+    if (nwords < 6) {
+      // not a shared library entry. ignore.
+      continue;
+    }
+
+    // SA does not handle the lines with patterns:
+    //   "[stack]", "[heap]", "[vdso]", "[vsyscall]", etc.
+    if (word[5][0] == '[') {
+        // not a shared library entry. ignore.
+        continue;
+    }
+
+    if (nwords > 6) {
+      // prelink altered mapfile when the program is running.
+      // Entries like one below have to be skipped
+      //  /lib64/libc-2.15.so (deleted)
+      // SO name in entries like one below have to be stripped.
+      //  /lib64/libpthread-2.15.so.#prelink#.EECVts
+      char *s = strstr(word[5],".#prelink#");
+      if (s == NULL) {
+        // No prelink keyword. skip deleted library
+        print_debug("skip shared object %s deleted by prelink\n", word[5]);
+        continue;
+      }
+
+      // Fall through
+      print_debug("rectifying shared object name %s changed by prelink\n", word[5]);
+      *s = 0;
+    }
+
+    if (find_lib(ph, word[5]) == false) {
        intptr_t base;
        lib_info* lib;
 #ifdef _LP64
--- a/hotspot/make/bsd/makefiles/saproc.make	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/make/bsd/makefiles/saproc.make	Wed Jul 09 10:42:04 2014 -0700
@@ -64,9 +64,23 @@
 else
   ifeq ($(OS_VENDOR), Darwin)
     SASRCFILES = $(DARWIN_NON_STUB_SASRCFILES)
-    SALIBS = -g -framework Foundation -F/System/Library/Frameworks/JavaVM.framework/Frameworks -framework JavaNativeFoundation -framework Security -framework CoreFoundation
+    SALIBS = -g \
+             -framework Foundation \
+             -framework JavaNativeFoundation \
+             -framework Security \
+             -framework CoreFoundation
     #objc compiler blows up on -march=i586, perhaps it should not be included in the macosx intel 32-bit C++ compiles?
     SAARCH = $(subst -march=i586,,$(ARCHFLAG))
+
+    # This is needed to locate JavaNativeFoundation.framework
+    ifeq ($(SYSROOT_CFLAGS),)
+      # this will happen when building without spec.gmk, set SDKROOT to a valid SDK
+      # path if your system does not have headers installed in the system frameworks
+      SA_SYSROOT_FLAGS = -F"$(SDKROOT)/System/Library/Frameworks/JavaVM.framework/Frameworks"
+    else
+      # Just use SYSROOT_CFLAGS
+      SA_SYSROOT_FLAGS=$(SYSROOT_CFLAGS)
+    endif
   else
     SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c
     SALIBS = 
@@ -100,14 +114,8 @@
 endif
 SA_LFLAGS += $(LDFLAGS_HASH_STYLE)
 
-ifeq ($(OS_VENDOR), Darwin)
-  BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
-    -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]") \
-    -I/System/Library/Frameworks/JavaVM.framework/Headers
-else
-  BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
-    -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]")
-endif
+BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
+  -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]")
 
 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
 	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
@@ -116,6 +124,7 @@
 	fi
 	@echo Making SA debugger back-end...
 	$(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE                   \
+	           $(SA_SYSROOT_FLAGS)                                  \
 	           $(SYMFLAG) $(SAARCH) $(SHARED_FLAG) $(PICFLAG)       \
 	           -I$(SASRCDIR)                                        \
 	           -I$(GENERATED)                                       \
--- a/hotspot/make/bsd/makefiles/vm.make	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/make/bsd/makefiles/vm.make	Wed Jul 09 10:42:04 2014 -0700
@@ -295,6 +295,7 @@
 $(PRECOMPILED_HEADER):
 	$(QUIETLY) echo Generating precompiled header $@
 	$(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
+	$(QUIETLY) rm -f $@
 	$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
 
 # making the library:
--- a/hotspot/make/linux/makefiles/vm.make	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/make/linux/makefiles/vm.make	Wed Jul 09 10:42:04 2014 -0700
@@ -290,6 +290,7 @@
 $(PRECOMPILED_HEADER):
 	$(QUIETLY) echo Generating precompiled header $@
 	$(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
+	$(QUIETLY) rm -f $@
 	$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
 
 # making the library:
--- a/hotspot/make/windows/create.bat	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/make/windows/create.bat	Wed Jul 09 10:42:04 2014 -0700
@@ -1,6 +1,6 @@
 @echo off
 REM
-REM Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+REM Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
 REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 REM
 REM This code is free software; you can redistribute it and/or modify it
@@ -81,33 +81,8 @@
 for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i
 
 echo **************************************************************
-set ProjectFile=%HotSpotBuildSpace%\jvm.vcproj
 echo MSC_VER = "%MSC_VER%" 
-if "%MSC_VER%" == "1200" (
-set ProjectFile=%HotSpotBuildSpace%\jvm.dsp
-echo Will generate VC6 project {unsupported}
-) else (
-if "%MSC_VER%" == "1400" (
-echo Will generate VC8 {Visual Studio 2005}
-) else (
-if "%MSC_VER%" == "1500" (
-echo Will generate VC9 {Visual Studio 2008}
-) else (
-if "%MSC_VER%" == "1600" (
-echo Will generate VC10 {Visual Studio 2010}
 set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj
-) else (
-if "%MSC_VER%" == "1700" (
-echo Will generate VC10 {compatible with Visual Studio 2012}
-echo After opening in VS 2012, click "Update" when prompted.
-set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj
-) else (
-echo Will generate VC7 project {Visual Studio 2003 .NET}
-)
-)
-)
-)
-)
 echo %ProjectFile%
 echo **************************************************************
 
--- a/hotspot/make/windows/makefiles/compile.make	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/make/windows/makefiles/compile.make	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -63,28 +63,20 @@
 # Based on BUILDARCH we add some flags and select the default compiler name
 !if "$(BUILDARCH)" == "ia64"
 MACHINE=IA64
-DEFAULT_COMPILER_NAME=VS2003
 CXX_FLAGS=$(CXX_FLAGS) /D "CC_INTERP" /D "_LP64" /D "IA64"
 !endif
 
 !if "$(BUILDARCH)" == "amd64"
 MACHINE=AMD64
-DEFAULT_COMPILER_NAME=VS2005
 CXX_FLAGS=$(CXX_FLAGS) /D "_LP64" /D "AMD64"
 LP64=1
 !endif
 
 !if "$(BUILDARCH)" == "i486"
 MACHINE=I386
-DEFAULT_COMPILER_NAME=VS2003
 CXX_FLAGS=$(CXX_FLAGS) /D "IA32"
 !endif
 
-# Sanity check, this is the default if not amd64, ia64, or i486
-!ifndef DEFAULT_COMPILER_NAME
-CXX=ARCH_ERROR
-!endif
-
 CXX_FLAGS=$(CXX_FLAGS) /D "WIN32" /D "_WINDOWS"
 # Must specify this for sharedRuntimeTrig.cpp
 CXX_FLAGS=$(CXX_FLAGS) /D "VM_LITTLE_ENDIAN"
@@ -112,6 +104,7 @@
 #      1500 is for VS2008
 #      1600 is for VS2010
 #      1700 is for VS2012
+#      1800 is for VS2013
 #    Do not confuse this MSC_VER with the predefined macro _MSC_VER that the
 #    compiler provides, when MSC_VER==1399, _MSC_VER will be 1400.
 #    Normally they are the same, but a pre-release of the VS2005 compilers
@@ -119,35 +112,6 @@
 #    closer to VS2003 in terms of option spellings, so we use 1399 for that
 #    1400 version that really isn't 1400.
 #    See the file get_msc_ver.sh for more info.
-!if "x$(MSC_VER)" == "x"
-COMPILER_NAME=$(DEFAULT_COMPILER_NAME)
-!else
-!if "$(MSC_VER)" == "1200"
-COMPILER_NAME=VC6
-!endif
-!if "$(MSC_VER)" == "1300"
-COMPILER_NAME=VS2003
-!endif
-!if "$(MSC_VER)" == "1310"
-COMPILER_NAME=VS2003
-!endif
-!if "$(MSC_VER)" == "1399"
-# Compiler might say 1400, but if it's 14.00.30701, it isn't really VS2005
-COMPILER_NAME=VS2003
-!endif
-!if "$(MSC_VER)" == "1400"
-COMPILER_NAME=VS2005
-!endif
-!if "$(MSC_VER)" == "1500"
-COMPILER_NAME=VS2008
-!endif
-!if "$(MSC_VER)" == "1600"
-COMPILER_NAME=VS2010
-!endif
-!if "$(MSC_VER)" == "1700"
-COMPILER_NAME=VS2012
-!endif
-!endif
 
 # By default, we do not want to use the debug version of the msvcrt.dll file
 #   but if MFC_DEBUG is defined in the environment it will be used.
@@ -165,60 +129,6 @@
 !endif
 CXX_FLAGS=$(CXX_FLAGS) $(MS_RUNTIME_OPTION)
 
-# How /GX option is spelled
-GX_OPTION = /GX
-
-# Optimization settings for various versions of the compilers and types of
-#    builds. Three basic sets of settings: product, fastdebug, and debug.
-#    These get added into CXX_FLAGS as needed by other makefiles.
-!if "$(COMPILER_NAME)" == "VC6"
-PRODUCT_OPT_OPTION   = /Ox /Os /Gy /GF
-FASTDEBUG_OPT_OPTION = /Ox /Os /Gy /GF
-DEBUG_OPT_OPTION     = /Od
-!endif
-
-!if "$(COMPILER_NAME)" == "VS2003"
-PRODUCT_OPT_OPTION   = /O2 /Oy-
-FASTDEBUG_OPT_OPTION = /O2 /Oy-
-DEBUG_OPT_OPTION     = /Od
-SAFESEH_FLAG = /SAFESEH
-!endif
-
-!if "$(COMPILER_NAME)" == "VS2005"
-PRODUCT_OPT_OPTION   = /O2 /Oy-
-FASTDEBUG_OPT_OPTION = /O2 /Oy-
-DEBUG_OPT_OPTION     = /Od
-GX_OPTION = /EHsc
-# This VS2005 compiler has /GS as a default and requires bufferoverflowU.lib 
-#    on the link command line, otherwise we get missing __security_check_cookie
-#    externals at link time. Even with /GS-, you need bufferoverflowU.lib.
-#    NOTE: Currently we decided to not use /GS-
-BUFFEROVERFLOWLIB = bufferoverflowU.lib
-LD_FLAGS = /manifest $(LD_FLAGS) $(BUFFEROVERFLOWLIB)
-# Manifest Tool - used in VS2005 and later to adjust manifests stored
-# as resources inside build artifacts.
-!if "x$(MT)" == "x"
-MT=mt.exe
-!endif
-SAFESEH_FLAG = /SAFESEH
-!endif
-
-!if "$(COMPILER_NAME)" == "VS2008"
-PRODUCT_OPT_OPTION   = /O2 /Oy-
-FASTDEBUG_OPT_OPTION = /O2 /Oy-
-DEBUG_OPT_OPTION     = /Od
-GX_OPTION = /EHsc
-LD_FLAGS = /manifest $(LD_FLAGS)
-MP_FLAG = /MP
-# Manifest Tool - used in VS2005 and later to adjust manifests stored
-# as resources inside build artifacts.
-!if "x$(MT)" == "x"
-MT=mt.exe
-!endif
-SAFESEH_FLAG = /SAFESEH
-!endif
-
-!if "$(COMPILER_NAME)" == "VS2010"
 PRODUCT_OPT_OPTION   = /O2 /Oy-
 FASTDEBUG_OPT_OPTION = /O2 /Oy-
 DEBUG_OPT_OPTION     = /Od
@@ -233,26 +143,6 @@
 !if "$(BUILDARCH)" == "i486"
 LD_FLAGS = /SAFESEH $(LD_FLAGS)
 !endif
-!endif
-
-!if "$(COMPILER_NAME)" == "VS2012"
-PRODUCT_OPT_OPTION   = /O2 /Oy-
-FASTDEBUG_OPT_OPTION = /O2 /Oy-
-DEBUG_OPT_OPTION     = /Od
-GX_OPTION = /EHsc
-LD_FLAGS = /manifest $(LD_FLAGS)
-MP_FLAG = /MP
-# Manifest Tool - used in VS2005 and later to adjust manifests stored
-# as resources inside build artifacts.
-!if "x$(MT)" == "x"
-MT=mt.exe
-!endif
-SAFESEH_FLAG = /SAFESEH
-!endif
-
-!if "$(BUILDARCH)" == "i486"
-LD_FLAGS = $(SAFESEH_FLAG) $(LD_FLAGS)
-!endif
 
 CXX_FLAGS = $(CXX_FLAGS) $(MP_FLAG)
 
--- a/hotspot/make/windows/makefiles/rules.make	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/make/windows/makefiles/rules.make	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2013, 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
@@ -49,35 +49,8 @@
 JAVAC_FLAGS=-g -encoding ascii
 BOOTSTRAP_JAVAC_FLAGS=$(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
 
-ProjectFile=jvm.vcproj
-
-!if "$(MSC_VER)" == "1200"
-
-VcVersion=VC6
-ProjectFile=jvm.dsp
-
-!elseif "$(MSC_VER)" == "1400"
-
-VcVersion=VC8
-
-!elseif "$(MSC_VER)" == "1500"
-
-VcVersion=VC9
-
-!elseif "$(MSC_VER)" == "1600"
-
+# VS2012 and VS2013 loads VS10 projects just fine (and will
+# upgrade them automatically to VS2012 format).
 VcVersion=VC10
 ProjectFile=jvm.vcxproj
 
-!elseif "$(MSC_VER)" == "1700"
-# This is VS2012, but it loads VS10 projects just fine (and will
-# upgrade them automatically to VS2012 format).
-
-VcVersion=VC10
-ProjectFile=jvm.vcxproj
-
-!else
-
-VcVersion=VC7
-
-!endif
--- a/hotspot/make/windows/makefiles/sa.make	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/make/windows/makefiles/sa.make	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2013, 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
@@ -85,14 +85,9 @@
 # will be useful to have the assertion checks in place
 
 !if "$(BUILDARCH)" == "ia64"
-SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c
+SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -c
 !elseif "$(BUILDARCH)" == "amd64"
-SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c
-!if "$(COMPILER_NAME)" == "VS2005"
-# On amd64, VS2005 compiler requires bufferoverflowU.lib on the link command line, 
-# otherwise we get missing __security_check_cookie externals at link time. 
-SA_LD_FLAGS = bufferoverflowU.lib
-!endif
+SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -c
 !else
 SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -RTC1 -c 
 !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
--- a/hotspot/make/windows/makefiles/sanity.make	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/make/windows/makefiles/sanity.make	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -27,9 +27,9 @@
 all: checkCL checkLink
 
 checkCL:
-	@ if "$(MSC_VER)" NEQ "1310" if "$(MSC_VER)" NEQ "1399" if "$(MSC_VER)" NEQ "1400" if "$(MSC_VER)" NEQ "1500" if "$(MSC_VER)" NEQ "1600" if "$(MSC_VER)" NEQ "1700" \
-	echo *** WARNING *** unrecognized cl.exe version $(MSC_VER) ($(RAW_MSC_VER)).  Use FORCE_MSC_VER to override automatic detection.
+	@ if "$(MSC_VER)" NEQ "1600" if "$(MSC_VER)" NEQ "1700" if "$(MSC_VER)" NEQ "1800" \
+	echo *** WARNING *** Unsupported cl.exe version detected: $(MSC_VER) ($(RAW_MSC_VER)), only 1600/1700/1800 (Visual Studio 2010/2012/2013) are supported.
 
 checkLink:
-	@ if "$(LD_VER)" NEQ "710" if "$(LD_VER)" NEQ "800" if "$(LD_VER)" NEQ "900" if "$(LD_VER)" NEQ "1000" if "$(LD_VER)" NEQ "1100" \
-	echo *** WARNING *** unrecognized link.exe version $(LD_VER) ($(RAW_LD_VER)).  Use FORCE_LD_VER to override automatic detection.
+	@ if "$(LD_VER)" NEQ "1000" if "$(LD_VER)" NEQ "1100" if "$(LD_VER)" NEQ "1200" \
+	echo *** WARNING *** Unsupported link.exe version detected: $(LD_VER) ($(RAW_LD_VER)), only 1000/1100/1200 (Visual Studio 2010/2012/2013) are supported.
--- a/hotspot/make/windows/makefiles/vm.make	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/make/windows/makefiles/vm.make	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -132,7 +132,7 @@
 
 !if "$(USE_PRECOMPILED_HEADER)" != "0"
 CXX_USE_PCH=/Fp"vm.pch" /Yu"precompiled.hpp"
-!if "$(COMPILER_NAME)" == "VS2012"
+!if "$(MSC_VER)" > "1600"
 # VS2012 requires this object file to be listed:
 LD_FLAGS=$(LD_FLAGS) _build_pch_file.obj
 !endif
--- a/hotspot/make/windows/projectfiles/common/Makefile	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/make/windows/projectfiles/common/Makefile	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -120,7 +120,6 @@
 ProjectCreatorIDEOptions = $(ProjectCreatorIDEOptions) $(ReleaseOptions)
 
 $(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class
-	@if "$(MSC_VER)"=="1500" echo Make sure you have VS2008 SP1 or later, or you may see 'expanded command line too long'
 	@$(RUN_JAVA) -Djava.class.path="$(HOTSPOTBUILDSPACE)/classes" ProjectCreator WinGammaPlatform$(VcVersion) $(ProjectCreatorIDEOptions)
 
 clean:
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -625,6 +625,7 @@
     __ lea(rscratch1, polling_page);
     offset = __ offset();
     add_debug_info_for_branch(info);
+    __ relocate(relocInfo::poll_type);
     __ testl(rax, Address(rscratch1, 0));
   } else {
     add_debug_info_for_branch(info);
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -786,7 +786,7 @@
       case os::java_thread:
         // Java threads use ThreadStackSize which default value can be
         // changed with the flag -Xss
-        assert (JavaThread::stack_size_at_create() > 0, "this should be set");
+        assert(JavaThread::stack_size_at_create() > 0, "this should be set");
         stack_size = JavaThread::stack_size_at_create();
         break;
       case os::compiler_thread:
@@ -1303,7 +1303,7 @@
     if (pelements == NULL) {
       return false;
     }
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       // Really shouldn't be NULL, but check can't hurt
       if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
         continue; // skip the empty path values
@@ -1316,7 +1316,7 @@
       }
     }
     // release the storage
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
         FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
       }
@@ -1467,7 +1467,7 @@
 
   bool failed_to_read_elf_head=
     (sizeof(elf_head)!=
-        (::read(file_descriptor, &elf_head,sizeof(elf_head)))) ;
+        (::read(file_descriptor, &elf_head,sizeof(elf_head))));
 
   ::close(file_descriptor);
   if (failed_to_read_elf_head) {
@@ -1565,7 +1565,7 @@
   arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
   int running_arch_index=-1;
 
-  for (unsigned int i=0 ; i < ARRAY_SIZE(arch_array) ; i++ ) {
+  for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
     if (running_arch_code == arch_array[i].code) {
       running_arch_index    = i;
     }
@@ -1596,7 +1596,7 @@
 #endif // !S390
 
   if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) {
-    if ( lib_arch.name!=NULL ) {
+    if (lib_arch.name!=NULL) {
       ::snprintf(diag_msg_buf, diag_msg_max_length-1,
         " (Possible cause: can't load %s-bit .so on a %s-bit platform)",
         lib_arch.name, arch_array[running_arch_index].name);
@@ -2598,7 +2598,7 @@
   sched_yield();
 }
 
-os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN ;}
+os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN; }
 
 void os::yield_all() {
   // Yields to all threads, including threads with lower priorities
@@ -2686,7 +2686,7 @@
 }
 
 OSReturn os::set_native_priority(Thread* thread, int newpri) {
-  if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) return OS_OK;
+  if (!UseThreadPriorities || ThreadPriorityPolicy == 0) return OS_OK;
 
 #ifdef __OpenBSD__
   // OpenBSD pthread_setprio starves low priority threads
@@ -2713,7 +2713,7 @@
 }
 
 OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
-  if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) {
+  if (!UseThreadPriorities || ThreadPriorityPolicy == 0) {
     *priority_ptr = java_to_os_priority[NormPriority];
     return OS_OK;
   }
@@ -3079,7 +3079,7 @@
 }
 
 struct sigaction* os::Bsd::get_preinstalled_handler(int sig) {
-  if ((( (unsigned int)1 << sig ) & sigs) != 0) {
+  if ((((unsigned int)1 << sig) & sigs) != 0) {
     return &sigact[sig];
   }
   return NULL;
@@ -3300,7 +3300,7 @@
 
   address rh = VMError::get_resetted_sighandler(sig);
   // May be, handler was resetted by VMError?
-  if(rh != NULL) {
+  if (rh != NULL) {
     handler = rh;
     sa.sa_flags = VMError::get_resetted_sigflags(sig) & SIGNIFICANT_SIGNAL_MASK;
   }
@@ -3309,11 +3309,11 @@
   os::Posix::print_sa_flags(st, sa.sa_flags);
 
   // Check: is it our handler?
-  if(handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
+  if (handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
      handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler)) {
     // It is our signal handler
     // check for flags, reset system-used one!
-    if((int)sa.sa_flags != os::Bsd::get_our_sigflags(sig)) {
+    if ((int)sa.sa_flags != os::Bsd::get_our_sigflags(sig)) {
       st->print(
                 ", flags was changed from " PTR32_FORMAT ", consider using jsig library",
                 os::Bsd::get_our_sigflags(sig));
@@ -3382,10 +3382,10 @@
 
   address thisHandler = (act.sa_flags & SA_SIGINFO)
     ? CAST_FROM_FN_PTR(address, act.sa_sigaction)
-    : CAST_FROM_FN_PTR(address, act.sa_handler) ;
-
-
-  switch(sig) {
+    : CAST_FROM_FN_PTR(address, act.sa_handler);
+
+
+  switch (sig) {
   case SIGSEGV:
   case SIGBUS:
   case SIGFPE:
@@ -3515,22 +3515,22 @@
 {
   // Allocate a single page and mark it as readable for safepoint polling
   address polling_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-  guarantee( polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page" );
-
-  os::set_polling_page( polling_page );
+  guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page");
+
+  os::set_polling_page(polling_page);
 
 #ifndef PRODUCT
-  if(Verbose && PrintMiscellaneous)
+  if (Verbose && PrintMiscellaneous)
     tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
 #endif
 
   if (!UseMembar) {
     address mem_serialize_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-    guarantee( mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
-    os::set_memory_serialize_page( mem_serialize_page );
+    guarantee(mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
+    os::set_memory_serialize_page(mem_serialize_page);
 
 #ifndef PRODUCT
-    if(Verbose && PrintMiscellaneous)
+    if (Verbose && PrintMiscellaneous)
       tty->print("[Memory Serialize  Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
 #endif
   }
@@ -3631,13 +3631,13 @@
 
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
-  if( !guard_memory((char*)_polling_page, Bsd::page_size()) )
+  if (!guard_memory((char*)_polling_page, Bsd::page_size()))
     fatal("Could not disable polling page");
 };
 
 // Mark the polling page as readable
 void os::make_polling_page_readable(void) {
-  if( !bsd_mprotect((char *)_polling_page, Bsd::page_size(), PROT_READ)) {
+  if (!bsd_mprotect((char *)_polling_page, Bsd::page_size(), PROT_READ)) {
     fatal("Could not enable polling page");
   }
 };
@@ -4229,9 +4229,9 @@
 
 int os::PlatformEvent::TryPark() {
   for (;;) {
-    const int v = _Event ;
-    guarantee ((v == 0) || (v == 1), "invariant") ;
-    if (Atomic::cmpxchg (0, &_Event, v) == v) return v  ;
+    const int v = _Event;
+    guarantee((v == 0) || (v == 1), "invariant");
+    if (Atomic::cmpxchg(0, &_Event, v) == v) return v;
   }
 }
 
@@ -4239,18 +4239,18 @@
   // Invariant: Only the thread associated with the Event/PlatformEvent
   // may call park().
   // TODO: assert that _Assoc != NULL or _Assoc == Self
-  int v ;
+  int v;
   for (;;) {
-      v = _Event ;
-      if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
+      v = _Event;
+      if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
   }
-  guarantee (v >= 0, "invariant") ;
+  guarantee(v >= 0, "invariant");
   if (v == 0) {
      // Do this the hard way by blocking ...
      int status = pthread_mutex_lock(_mutex);
      assert_status(status == 0, status, "mutex_lock");
-     guarantee (_nParked == 0, "invariant") ;
-     ++ _nParked ;
+     guarantee(_nParked == 0, "invariant");
+     ++_nParked;
      while (_Event < 0) {
         status = pthread_cond_wait(_cond, _mutex);
         // for some reason, under 2.7 lwp_cond_wait() may return ETIME ...
@@ -4258,28 +4258,28 @@
         if (status == ETIMEDOUT) { status = EINTR; }
         assert_status(status == 0 || status == EINTR, status, "cond_wait");
      }
-     -- _nParked ;
-
-    _Event = 0 ;
+     --_nParked;
+
+    _Event = 0;
      status = pthread_mutex_unlock(_mutex);
      assert_status(status == 0, status, "mutex_unlock");
     // Paranoia to ensure our locked and lock-free paths interact
     // correctly with each other.
     OrderAccess::fence();
   }
-  guarantee (_Event >= 0, "invariant") ;
+  guarantee(_Event >= 0, "invariant");
 }
 
 int os::PlatformEvent::park(jlong millis) {
-  guarantee (_nParked == 0, "invariant") ;
-
-  int v ;
+  guarantee(_nParked == 0, "invariant");
+
+  int v;
   for (;;) {
-      v = _Event ;
-      if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
+      v = _Event;
+      if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
   }
-  guarantee (v >= 0, "invariant") ;
-  if (v != 0) return OS_OK ;
+  guarantee(v >= 0, "invariant");
+  if (v != 0) return OS_OK;
 
   // We do this the hard way, by blocking the thread.
   // Consider enforcing a minimum timeout value.
@@ -4289,8 +4289,8 @@
   int ret = OS_TIMEOUT;
   int status = pthread_mutex_lock(_mutex);
   assert_status(status == 0, status, "mutex_lock");
-  guarantee (_nParked == 0, "invariant") ;
-  ++_nParked ;
+  guarantee(_nParked == 0, "invariant");
+  ++_nParked;
 
   // Object.wait(timo) will return because of
   // (a) notification
@@ -4308,24 +4308,24 @@
   while (_Event < 0) {
     status = os::Bsd::safe_cond_timedwait(_cond, _mutex, &abst);
     if (status != 0 && WorkAroundNPTLTimedWaitHang) {
-      pthread_cond_destroy (_cond);
-      pthread_cond_init (_cond, NULL) ;
+      pthread_cond_destroy(_cond);
+      pthread_cond_init(_cond, NULL);
     }
     assert_status(status == 0 || status == EINTR ||
                   status == ETIMEDOUT,
                   status, "cond_timedwait");
-    if (!FilterSpuriousWakeups) break ;                 // previous semantics
-    if (status == ETIMEDOUT) break ;
+    if (!FilterSpuriousWakeups) break;                 // previous semantics
+    if (status == ETIMEDOUT) break;
     // We consume and ignore EINTR and spurious wakeups.
   }
-  --_nParked ;
+  --_nParked;
   if (_Event >= 0) {
      ret = OS_OK;
   }
-  _Event = 0 ;
+  _Event = 0;
   status = pthread_mutex_unlock(_mutex);
   assert_status(status == 0, status, "mutex_unlock");
-  assert (_nParked == 0, "invariant") ;
+  assert(_nParked == 0, "invariant");
   // Paranoia to ensure our locked and lock-free paths interact
   // correctly with each other.
   OrderAccess::fence();
@@ -4409,7 +4409,7 @@
  */
 
 static void unpackTime(struct timespec* absTime, bool isAbsolute, jlong time) {
-  assert (time > 0, "convertTime");
+  assert(time > 0, "convertTime");
 
   struct timeval now;
   int status = gettimeofday(&now, NULL);
@@ -4470,7 +4470,7 @@
 
   // Next, demultiplex/decode time arguments
   struct timespec absTime;
-  if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
+  if (time < 0 || (isAbsolute && time == 0)) { // don't wait at all
     return;
   }
   if (time > 0) {
@@ -4492,11 +4492,11 @@
     return;
   }
 
-  int status ;
+  int status;
   if (_counter > 0)  { // no wait needed
     _counter = 0;
     status = pthread_mutex_unlock(_mutex);
-    assert (status == 0, "invariant") ;
+    assert(status == 0, "invariant");
     // Paranoia to ensure our locked and lock-free paths interact
     // correctly with each other and Java-level accesses.
     OrderAccess::fence();
@@ -4516,12 +4516,12 @@
   // cleared by handle_special_suspend_equivalent_condition() or java_suspend_self()
 
   if (time == 0) {
-    status = pthread_cond_wait (_cond, _mutex) ;
+    status = pthread_cond_wait(_cond, _mutex);
   } else {
-    status = os::Bsd::safe_cond_timedwait (_cond, _mutex, &absTime) ;
+    status = os::Bsd::safe_cond_timedwait(_cond, _mutex, &absTime);
     if (status != 0 && WorkAroundNPTLTimedWaitHang) {
-      pthread_cond_destroy (_cond) ;
-      pthread_cond_init    (_cond, NULL);
+      pthread_cond_destroy(_cond);
+      pthread_cond_init(_cond, NULL);
     }
   }
   assert_status(status == 0 || status == EINTR ||
@@ -4532,9 +4532,9 @@
   pthread_sigmask(SIG_SETMASK, &oldsigs, NULL);
 #endif
 
-  _counter = 0 ;
-  status = pthread_mutex_unlock(_mutex) ;
-  assert_status(status == 0, status, "invariant") ;
+  _counter = 0;
+  status = pthread_mutex_unlock(_mutex);
+  assert_status(status == 0, status, "invariant");
   // Paranoia to ensure our locked and lock-free paths interact
   // correctly with each other and Java-level accesses.
   OrderAccess::fence();
@@ -4546,26 +4546,26 @@
 }
 
 void Parker::unpark() {
-  int s, status ;
+  int s, status;
   status = pthread_mutex_lock(_mutex);
-  assert (status == 0, "invariant") ;
+  assert(status == 0, "invariant");
   s = _counter;
   _counter = 1;
   if (s < 1) {
      if (WorkAroundNPTLTimedWaitHang) {
-        status = pthread_cond_signal (_cond) ;
-        assert (status == 0, "invariant") ;
+        status = pthread_cond_signal(_cond);
+        assert(status == 0, "invariant");
         status = pthread_mutex_unlock(_mutex);
-        assert (status == 0, "invariant") ;
+        assert(status == 0, "invariant");
      } else {
         status = pthread_mutex_unlock(_mutex);
-        assert (status == 0, "invariant") ;
-        status = pthread_cond_signal (_cond) ;
-        assert (status == 0, "invariant") ;
+        assert(status == 0, "invariant");
+        status = pthread_cond_signal(_cond);
+        assert(status == 0, "invariant");
      }
   } else {
     pthread_mutex_unlock(_mutex);
-    assert (status == 0, "invariant") ;
+    assert(status == 0, "invariant");
   }
 }
 
--- a/hotspot/src/os/bsd/vm/os_bsd.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -191,16 +191,16 @@
 
 class PlatformEvent : public CHeapObj<mtInternal> {
   private:
-    double CachePad [4] ;   // increase odds that _mutex is sole occupant of cache line
-    volatile int _Event ;
-    volatile int _nParked ;
-    pthread_mutex_t _mutex  [1] ;
-    pthread_cond_t  _cond   [1] ;
-    double PostPad  [2] ;
-    Thread * _Assoc ;
+    double CachePad[4];   // increase odds that _mutex is sole occupant of cache line
+    volatile int _Event;
+    volatile int _nParked;
+    pthread_mutex_t _mutex[1];
+    pthread_cond_t  _cond[1];
+    double PostPad[2];
+    Thread * _Assoc;
 
   public:       // TODO-FIXME: make dtor private
-    ~PlatformEvent() { guarantee (0, "invariant") ; }
+    ~PlatformEvent() { guarantee(0, "invariant"); }
 
   public:
     PlatformEvent() {
@@ -209,28 +209,28 @@
       assert_status(status == 0, status, "cond_init");
       status = pthread_mutex_init (_mutex, NULL);
       assert_status(status == 0, status, "mutex_init");
-      _Event   = 0 ;
-      _nParked = 0 ;
-      _Assoc   = NULL ;
+      _Event   = 0;
+      _nParked = 0;
+      _Assoc   = NULL;
     }
 
     // Use caution with reset() and fired() -- they may require MEMBARs
-    void reset() { _Event = 0 ; }
+    void reset() { _Event = 0; }
     int  fired() { return _Event; }
-    void park () ;
-    void unpark () ;
-    int  TryPark () ;
-    int  park (jlong millis) ;
-    void SetAssociation (Thread * a) { _Assoc = a ; }
+    void park();
+    void unpark();
+    int  TryPark();
+    int  park(jlong millis);
+    void SetAssociation(Thread * a) { _Assoc = a; }
 };
 
 class PlatformParker : public CHeapObj<mtInternal> {
   protected:
-    pthread_mutex_t _mutex [1] ;
-    pthread_cond_t  _cond  [1] ;
+    pthread_mutex_t _mutex[1];
+    pthread_cond_t  _cond[1];
 
   public:       // TODO-FIXME: make dtor private
-    ~PlatformParker() { guarantee (0, "invariant") ; }
+    ~PlatformParker() { guarantee(0, "invariant"); }
 
   public:
     PlatformParker() {
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -862,7 +862,7 @@
       case os::java_thread:
         // Java threads use ThreadStackSize which default value can be
         // changed with the flag -Xss
-        assert (JavaThread::stack_size_at_create() > 0, "this should be set");
+        assert(JavaThread::stack_size_at_create() > 0, "this should be set");
         stack_size = JavaThread::stack_size_at_create();
         break;
       case os::compiler_thread:
@@ -1097,7 +1097,7 @@
         if (low <= addr && addr < high) {
            if (vma_low)  *vma_low  = low;
            if (vma_high) *vma_high = high;
-           fclose (fp);
+           fclose(fp);
            return true;
         }
       }
@@ -1420,7 +1420,7 @@
   // must return at least tp.tv_sec == 0 which means a resolution
   // better than 1 sec. This is extra check for reliability.
 
-  if(pthread_getcpuclockid_func &&
+  if (pthread_getcpuclockid_func &&
      pthread_getcpuclockid_func(_main_thread, &clockid) == 0 &&
      sys_clock_getres(clockid, &tp) == 0 && tp.tv_sec == 0) {
 
@@ -1630,7 +1630,7 @@
     if (pelements == NULL) {
       return false;
     }
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       // Really shouldn't be NULL, but check can't hurt
       if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
         continue; // skip the empty path values
@@ -1642,7 +1642,7 @@
       }
     }
     // release the storage
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
         FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
       }
@@ -1906,7 +1906,7 @@
 
   bool failed_to_read_elf_head=
     (sizeof(elf_head)!=
-        (::read(file_descriptor, &elf_head,sizeof(elf_head)))) ;
+        (::read(file_descriptor, &elf_head,sizeof(elf_head))));
 
   ::close(file_descriptor);
   if (failed_to_read_elf_head) {
@@ -1988,7 +1988,7 @@
   arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
   int running_arch_index=-1;
 
-  for (unsigned int i=0 ; i < ARRAY_SIZE(arch_array) ; i++ ) {
+  for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
     if (running_arch_code == arch_array[i].code) {
       running_arch_index    = i;
     }
@@ -2019,7 +2019,7 @@
 #endif // !S390
 
   if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) {
-    if ( lib_arch.name!=NULL ) {
+    if (lib_arch.name!=NULL) {
       ::snprintf(diag_msg_buf, diag_msg_max_length-1,
         " (Possible cause: can't load %s-bit .so on a %s-bit platform)",
         lib_arch.name, arch_array[running_arch_index].name);
@@ -3793,7 +3793,7 @@
   sched_yield();
 }
 
-os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN ;}
+os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN; }
 
 void os::yield_all() {
   // Yields to all threads, including threads with lower priorities
@@ -3858,14 +3858,14 @@
 }
 
 OSReturn os::set_native_priority(Thread* thread, int newpri) {
-  if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) return OS_OK;
+  if (!UseThreadPriorities || ThreadPriorityPolicy == 0) return OS_OK;
 
   int ret = setpriority(PRIO_PROCESS, thread->osthread()->thread_id(), newpri);
   return (ret == 0) ? OS_OK : OS_ERR;
 }
 
 OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
-  if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) {
+  if (!UseThreadPriorities || ThreadPriorityPolicy == 0) {
     *priority_ptr = java_to_os_priority[NormPriority];
     return OS_OK;
   }
@@ -4219,7 +4219,7 @@
 }
 
 struct sigaction* os::Linux::get_preinstalled_handler(int sig) {
-  if ((( (unsigned int)1 << sig ) & sigs) != 0) {
+  if ((((unsigned int)1 << sig) & sigs) != 0) {
     return &sigact[sig];
   }
   return NULL;
@@ -4423,7 +4423,7 @@
 
   address rh = VMError::get_resetted_sighandler(sig);
   // May be, handler was resetted by VMError?
-  if(rh != NULL) {
+  if (rh != NULL) {
     handler = rh;
     sa.sa_flags = VMError::get_resetted_sigflags(sig) & SIGNIFICANT_SIGNAL_MASK;
   }
@@ -4432,11 +4432,11 @@
   os::Posix::print_sa_flags(st, sa.sa_flags);
 
   // Check: is it our handler?
-  if(handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
+  if (handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
      handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler)) {
     // It is our signal handler
     // check for flags, reset system-used one!
-    if((int)sa.sa_flags != os::Linux::get_our_sigflags(sig)) {
+    if ((int)sa.sa_flags != os::Linux::get_our_sigflags(sig)) {
       st->print(
                 ", flags was changed from " PTR32_FORMAT ", consider using jsig library",
                 os::Linux::get_our_sigflags(sig));
@@ -4507,10 +4507,10 @@
 
   address thisHandler = (act.sa_flags & SA_SIGINFO)
     ? CAST_FROM_FN_PTR(address, act.sa_sigaction)
-    : CAST_FROM_FN_PTR(address, act.sa_handler) ;
-
-
-  switch(sig) {
+    : CAST_FROM_FN_PTR(address, act.sa_handler);
+
+
+  switch (sig) {
   case SIGSEGV:
   case SIGBUS:
   case SIGFPE:
@@ -4662,22 +4662,22 @@
 
   // Allocate a single page and mark it as readable for safepoint polling
   address polling_page = (address) ::mmap(NULL, Linux::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-  guarantee( polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page" );
-
-  os::set_polling_page( polling_page );
+  guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page");
+
+  os::set_polling_page(polling_page);
 
 #ifndef PRODUCT
-  if(Verbose && PrintMiscellaneous)
+  if (Verbose && PrintMiscellaneous)
     tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
 #endif
 
   if (!UseMembar) {
     address mem_serialize_page = (address) ::mmap(NULL, Linux::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-    guarantee( mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
-    os::set_memory_serialize_page( mem_serialize_page );
+    guarantee(mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
+    os::set_memory_serialize_page(mem_serialize_page);
 
 #ifndef PRODUCT
-    if(Verbose && PrintMiscellaneous)
+    if (Verbose && PrintMiscellaneous)
       tty->print("[Memory Serialize  Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
 #endif
   }
@@ -4819,13 +4819,13 @@
 
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
-  if( !guard_memory((char*)_polling_page, Linux::page_size()) )
+  if (!guard_memory((char*)_polling_page, Linux::page_size()))
     fatal("Could not disable polling page");
 };
 
 // Mark the polling page as readable
 void os::make_polling_page_readable(void) {
-  if( !linux_mprotect((char *)_polling_page, Linux::page_size(), PROT_READ)) {
+  if (!linux_mprotect((char *)_polling_page, Linux::page_size(), PROT_READ)) {
     fatal("Could not enable polling page");
   }
 };
@@ -5288,7 +5288,7 @@
 
   snprintf(proc_name, 64, "/proc/self/task/%d/stat", tid);
   fp = fopen(proc_name, "r");
-  if ( fp == NULL ) return -1;
+  if (fp == NULL) return -1;
   statlen = fread(stat, 1, 2047, fp);
   stat[statlen] = '\0';
   fclose(fp);
@@ -5300,7 +5300,7 @@
   // We don't really need to know the command string, just find the last
   // occurrence of ")" and then start parsing from there. See bug 4726580.
   s = strrchr(stat, ')');
-  if (s == NULL ) return -1;
+  if (s == NULL) return -1;
 
   // Skip blank chars
   do s++; while (isspace(*s));
@@ -5309,7 +5309,7 @@
                  &cdummy, &idummy, &idummy, &idummy, &idummy, &idummy,
                  &ldummy, &ldummy, &ldummy, &ldummy, &ldummy,
                  &user_time, &sys_time);
-  if ( count != 13 ) return -1;
+  if (count != 13) return -1;
   if (user_sys_cpu_time) {
     return ((jlong)sys_time + (jlong)user_time) * (1000000000 / clock_tics_per_sec);
   } else {
@@ -5468,9 +5468,9 @@
 
 int os::PlatformEvent::TryPark() {
   for (;;) {
-    const int v = _Event ;
-    guarantee ((v == 0) || (v == 1), "invariant") ;
-    if (Atomic::cmpxchg (0, &_Event, v) == v) return v  ;
+    const int v = _Event;
+    guarantee((v == 0) || (v == 1), "invariant");
+    if (Atomic::cmpxchg(0, &_Event, v) == v) return v;
   }
 }
 
@@ -5478,18 +5478,18 @@
   // Invariant: Only the thread associated with the Event/PlatformEvent
   // may call park().
   // TODO: assert that _Assoc != NULL or _Assoc == Self
-  int v ;
+  int v;
   for (;;) {
-      v = _Event ;
-      if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
-  }
-  guarantee (v >= 0, "invariant") ;
+      v = _Event;
+      if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
+  }
+  guarantee(v >= 0, "invariant");
   if (v == 0) {
      // Do this the hard way by blocking ...
      int status = pthread_mutex_lock(_mutex);
      assert_status(status == 0, status, "mutex_lock");
-     guarantee (_nParked == 0, "invariant") ;
-     ++ _nParked ;
+     guarantee(_nParked == 0, "invariant");
+     ++_nParked;
      while (_Event < 0) {
         status = pthread_cond_wait(_cond, _mutex);
         // for some reason, under 2.7 lwp_cond_wait() may return ETIME ...
@@ -5497,28 +5497,28 @@
         if (status == ETIME) { status = EINTR; }
         assert_status(status == 0 || status == EINTR, status, "cond_wait");
      }
-     -- _nParked ;
-
-    _Event = 0 ;
+     --_nParked;
+
+    _Event = 0;
      status = pthread_mutex_unlock(_mutex);
      assert_status(status == 0, status, "mutex_unlock");
     // Paranoia to ensure our locked and lock-free paths interact
     // correctly with each other.
     OrderAccess::fence();
   }
-  guarantee (_Event >= 0, "invariant") ;
+  guarantee(_Event >= 0, "invariant");
 }
 
 int os::PlatformEvent::park(jlong millis) {
-  guarantee (_nParked == 0, "invariant") ;
-
-  int v ;
+  guarantee(_nParked == 0, "invariant");
+
+  int v;
   for (;;) {
-      v = _Event ;
-      if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
-  }
-  guarantee (v >= 0, "invariant") ;
-  if (v != 0) return OS_OK ;
+      v = _Event;
+      if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
+  }
+  guarantee(v >= 0, "invariant");
+  if (v != 0) return OS_OK;
 
   // We do this the hard way, by blocking the thread.
   // Consider enforcing a minimum timeout value.
@@ -5528,8 +5528,8 @@
   int ret = OS_TIMEOUT;
   int status = pthread_mutex_lock(_mutex);
   assert_status(status == 0, status, "mutex_lock");
-  guarantee (_nParked == 0, "invariant") ;
-  ++_nParked ;
+  guarantee(_nParked == 0, "invariant");
+  ++_nParked;
 
   // Object.wait(timo) will return because of
   // (a) notification
@@ -5547,24 +5547,24 @@
   while (_Event < 0) {
     status = os::Linux::safe_cond_timedwait(_cond, _mutex, &abst);
     if (status != 0 && WorkAroundNPTLTimedWaitHang) {
-      pthread_cond_destroy (_cond);
-      pthread_cond_init (_cond, os::Linux::condAttr()) ;
+      pthread_cond_destroy(_cond);
+      pthread_cond_init(_cond, os::Linux::condAttr());
     }
     assert_status(status == 0 || status == EINTR ||
                   status == ETIME || status == ETIMEDOUT,
                   status, "cond_timedwait");
-    if (!FilterSpuriousWakeups) break ;                 // previous semantics
-    if (status == ETIME || status == ETIMEDOUT) break ;
+    if (!FilterSpuriousWakeups) break;                 // previous semantics
+    if (status == ETIME || status == ETIMEDOUT) break;
     // We consume and ignore EINTR and spurious wakeups.
   }
-  --_nParked ;
+  --_nParked;
   if (_Event >= 0) {
      ret = OS_OK;
   }
-  _Event = 0 ;
+  _Event = 0;
   status = pthread_mutex_unlock(_mutex);
   assert_status(status == 0, status, "mutex_unlock");
-  assert (_nParked == 0, "invariant") ;
+  assert(_nParked == 0, "invariant");
   // Paranoia to ensure our locked and lock-free paths interact
   // correctly with each other.
   OrderAccess::fence();
@@ -5647,7 +5647,7 @@
  */
 
 static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) {
-  assert (time > 0, "convertTime");
+  assert(time > 0, "convertTime");
   time_t max_secs = 0;
 
   if (!os::supports_monotonic_clock() || isAbsolute) {
@@ -5726,7 +5726,7 @@
 
   // Next, demultiplex/decode time arguments
   timespec absTime;
-  if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
+  if (time < 0 || (isAbsolute && time == 0)) { // don't wait at all
     return;
   }
   if (time > 0) {
@@ -5748,11 +5748,11 @@
     return;
   }
 
-  int status ;
+  int status;
   if (_counter > 0)  { // no wait needed
     _counter = 0;
     status = pthread_mutex_unlock(_mutex);
-    assert (status == 0, "invariant") ;
+    assert(status == 0, "invariant");
     // Paranoia to ensure our locked and lock-free paths interact
     // correctly with each other and Java-level accesses.
     OrderAccess::fence();
@@ -5774,13 +5774,13 @@
   assert(_cur_index == -1, "invariant");
   if (time == 0) {
     _cur_index = REL_INDEX; // arbitrary choice when not timed
-    status = pthread_cond_wait (&_cond[_cur_index], _mutex) ;
+    status = pthread_cond_wait(&_cond[_cur_index], _mutex);
   } else {
     _cur_index = isAbsolute ? ABS_INDEX : REL_INDEX;
-    status = os::Linux::safe_cond_timedwait (&_cond[_cur_index], _mutex, &absTime) ;
+    status = os::Linux::safe_cond_timedwait(&_cond[_cur_index], _mutex, &absTime);
     if (status != 0 && WorkAroundNPTLTimedWaitHang) {
-      pthread_cond_destroy (&_cond[_cur_index]) ;
-      pthread_cond_init    (&_cond[_cur_index], isAbsolute ? NULL : os::Linux::condAttr());
+      pthread_cond_destroy(&_cond[_cur_index]);
+      pthread_cond_init(&_cond[_cur_index], isAbsolute ? NULL : os::Linux::condAttr());
     }
   }
   _cur_index = -1;
@@ -5792,9 +5792,9 @@
   pthread_sigmask(SIG_SETMASK, &oldsigs, NULL);
 #endif
 
-  _counter = 0 ;
-  status = pthread_mutex_unlock(_mutex) ;
-  assert_status(status == 0, status, "invariant") ;
+  _counter = 0;
+  status = pthread_mutex_unlock(_mutex);
+  assert_status(status == 0, status, "invariant");
   // Paranoia to ensure our locked and lock-free paths interact
   // correctly with each other and Java-level accesses.
   OrderAccess::fence();
@@ -5806,9 +5806,9 @@
 }
 
 void Parker::unpark() {
-  int s, status ;
+  int s, status;
   status = pthread_mutex_lock(_mutex);
-  assert (status == 0, "invariant") ;
+  assert(status == 0, "invariant");
   s = _counter;
   _counter = 1;
   if (s < 1) {
@@ -5817,22 +5817,22 @@
       // thread is definitely parked
       if (WorkAroundNPTLTimedWaitHang) {
         status = pthread_cond_signal (&_cond[_cur_index]);
-        assert (status == 0, "invariant");
+        assert(status == 0, "invariant");
         status = pthread_mutex_unlock(_mutex);
-        assert (status == 0, "invariant");
+        assert(status == 0, "invariant");
       } else {
         status = pthread_mutex_unlock(_mutex);
-        assert (status == 0, "invariant");
+        assert(status == 0, "invariant");
         status = pthread_cond_signal (&_cond[_cur_index]);
-        assert (status == 0, "invariant");
+        assert(status == 0, "invariant");
       }
     } else {
       pthread_mutex_unlock(_mutex);
-      assert (status == 0, "invariant") ;
+      assert(status == 0, "invariant");
     }
   } else {
     pthread_mutex_unlock(_mutex);
-    assert (status == 0, "invariant") ;
+    assert(status == 0, "invariant");
   }
 }
 
--- a/hotspot/src/os/linux/vm/os_linux.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -287,16 +287,16 @@
 
 class PlatformEvent : public CHeapObj<mtInternal> {
   private:
-    double CachePad [4] ;   // increase odds that _mutex is sole occupant of cache line
-    volatile int _Event ;
-    volatile int _nParked ;
-    pthread_mutex_t _mutex  [1] ;
-    pthread_cond_t  _cond   [1] ;
-    double PostPad  [2] ;
-    Thread * _Assoc ;
+    double CachePad[4];   // increase odds that _mutex is sole occupant of cache line
+    volatile int _Event;
+    volatile int _nParked;
+    pthread_mutex_t _mutex[1];
+    pthread_cond_t  _cond[1];
+    double PostPad[2];
+    Thread * _Assoc;
 
   public:       // TODO-FIXME: make dtor private
-    ~PlatformEvent() { guarantee (0, "invariant") ; }
+    ~PlatformEvent() { guarantee(0, "invariant"); }
 
   public:
     PlatformEvent() {
@@ -305,20 +305,20 @@
       assert_status(status == 0, status, "cond_init");
       status = pthread_mutex_init (_mutex, NULL);
       assert_status(status == 0, status, "mutex_init");
-      _Event   = 0 ;
-      _nParked = 0 ;
-      _Assoc   = NULL ;
+      _Event   = 0;
+      _nParked = 0;
+      _Assoc   = NULL;
     }
 
     // Use caution with reset() and fired() -- they may require MEMBARs
-    void reset() { _Event = 0 ; }
+    void reset() { _Event = 0; }
     int  fired() { return _Event; }
-    void park () ;
-    void unpark () ;
-    int  TryPark () ;
-    int  park (jlong millis) ; // relative timed-wait only
-    void SetAssociation (Thread * a) { _Assoc = a ; }
-} ;
+    void park();
+    void unpark();
+    int  TryPark();
+    int  park(jlong millis); // relative timed-wait only
+    void SetAssociation(Thread * a) { _Assoc = a; }
+};
 
 class PlatformParker : public CHeapObj<mtInternal> {
   protected:
@@ -327,11 +327,11 @@
         ABS_INDEX = 1
     };
     int _cur_index;  // which cond is in use: -1, 0, 1
-    pthread_mutex_t _mutex [1] ;
-    pthread_cond_t  _cond  [2] ; // one for relative times and one for abs.
+    pthread_mutex_t _mutex[1];
+    pthread_cond_t  _cond[2]; // one for relative times and one for abs.
 
   public:       // TODO-FIXME: make dtor private
-    ~PlatformParker() { guarantee (0, "invariant") ; }
+    ~PlatformParker() { guarantee(0, "invariant"); }
 
   public:
     PlatformParker() {
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -212,13 +212,13 @@
               "sp must be inside of selected thread stack");
 
     thread->set_self_raw_id(raw_id);  // mark for quick retrieval
-    _get_thread_cache[ index ] = thread;
+    _get_thread_cache[index] = thread;
   }
   return thread;
 }
 
 
-static const double all_zero[ sizeof(Thread) / sizeof(double) + 1 ] = {0};
+static const double all_zero[sizeof(Thread) / sizeof(double) + 1] = {0};
 #define NO_CACHED_THREAD ((Thread*)all_zero)
 
 void ThreadLocalStorage::pd_set_thread(Thread* thread) {
@@ -270,8 +270,8 @@
 }
 
 address os::current_stack_base() {
-  int r = thr_main() ;
-  guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
+  int r = thr_main();
+  guarantee(r == 0 || r == 1, "CR6501650 or CR6493689");
   bool is_primordial_thread = r;
 
   // Workaround 4352906, avoid calls to thr_stksegment by
@@ -293,9 +293,9 @@
 size_t os::current_stack_size() {
   size_t size;
 
-  int r = thr_main() ;
-  guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
-  if(!r) {
+  int r = thr_main();
+  guarantee(r == 0 || r == 1, "CR6501650 or CR6493689");
+  if (!r) {
     size = get_stack_info().ss_size;
   } else {
     struct rlimit limits;
@@ -409,7 +409,7 @@
 
 static bool find_processors_online(processorid_t** id_array,
                                    uint*           id_length) {
-  const processorid_t MAX_PROCESSOR_ID = 100000 ;
+  const processorid_t MAX_PROCESSOR_ID = 100000;
   // Find the number of processors online.
   *id_length = sysconf(_SC_NPROCESSORS_ONLN);
   // Make up an array to hold their ids.
@@ -436,7 +436,7 @@
       // we've got.  Note that in the worst case find_processors_online() could
       // return an empty set.  (As a fall-back in the case of the empty set we
       // could just return the ID of the current processor).
-      *id_length = found ;
+      *id_length = found;
   }
 
   return true;
@@ -552,13 +552,13 @@
 }
 
 bool os::getenv(const char* name, char* buffer, int len) {
-  char* val = ::getenv( name );
-  if ( val == NULL
+  char* val = ::getenv(name);
+  if (val == NULL
   ||   strlen(val) + 1  >  len ) {
     if (len > 0)  buffer[0] = 0; // return a null string
     return false;
   }
-  strcpy( buffer, val );
+  strcpy(buffer, val);
   return true;
 }
 
@@ -672,7 +672,7 @@
 
     // Determine search path count and required buffer size.
     if (dlinfo(RTLD_SELF, RTLD_DI_SERINFOSIZE, (void *)info) == -1) {
-      FREE_C_HEAP_ARRAY(char, buf,  mtInternal);
+      FREE_C_HEAP_ARRAY(char, buf, mtInternal);
       vm_exit_during_initialization("dlinfo SERINFOSIZE request", dlerror());
     }
 
@@ -683,7 +683,7 @@
 
     // Obtain search path information.
     if (dlinfo(RTLD_SELF, RTLD_DI_SERINFO, (void *)info) == -1) {
-      FREE_C_HEAP_ARRAY(char, buf,  mtInternal);
+      FREE_C_HEAP_ARRAY(char, buf, mtInternal);
       FREE_C_HEAP_ARRAY(char, info, mtInternal);
       vm_exit_during_initialization("dlinfo SERINFO request", dlerror());
     }
@@ -794,7 +794,7 @@
 bool os::Solaris::valid_stack_address(Thread* thread, address sp) {
   address  stackStart  = (address)thread->stack_base();
   address  stackEnd    = (address)(stackStart - (address)thread->stack_size());
-  if (sp < stackStart && sp >= stackEnd ) return true;
+  if (sp < stackStart && sp >= stackEnd) return true;
   return false;
 }
 
@@ -819,8 +819,8 @@
   Thread* thread = (Thread*)thread_addr;
   OSThread* osthr = thread->osthread();
 
-  osthr->set_lwp_id( _lwp_self() );  // Store lwp in case we are bound
-  thread->_schedctl = (void *) schedctl_init () ;
+  osthr->set_lwp_id(_lwp_self());  // Store lwp in case we are bound
+  thread->_schedctl = (void *) schedctl_init();
 
   if (UseNUMA) {
     int lgrp_id = os::numa_get_group_id();
@@ -839,8 +839,8 @@
   // in java_to_os_priority. So we save the native priority
   // in the osThread and recall it here.
 
-  if ( osthr->thread_id() != -1 ) {
-    if ( UseThreadPriorities ) {
+  if (osthr->thread_id() != -1) {
+    if (UseThreadPriorities) {
       int prio = osthr->native_priority();
       if (ThreadPriorityVerbose) {
         tty->print_cr("Starting Thread " INTPTR_FORMAT ", LWP is "
@@ -882,7 +882,7 @@
   // Store info on the Solaris thread into the OSThread
   osthread->set_thread_id(thread_id);
   osthread->set_lwp_id(_lwp_self());
-  thread->_schedctl = (void *) schedctl_init () ;
+  thread->_schedctl = (void *) schedctl_init();
 
   if (UseNUMA) {
     int lgrp_id = os::numa_get_group_id();
@@ -891,9 +891,9 @@
     }
   }
 
-  if ( ThreadPriorityVerbose ) {
+  if (ThreadPriorityVerbose) {
     tty->print_cr("In create_os_thread, Thread " INTPTR_FORMAT ", LWP is " INTPTR_FORMAT "\n",
-                  osthread->thread_id(), osthread->lwp_id() );
+                  osthread->thread_id(), osthread->lwp_id());
   }
 
   // Initial thread state is INITIALIZED, not SUSPENDED
@@ -974,9 +974,9 @@
     return false;
   }
 
-  if ( ThreadPriorityVerbose ) {
+  if (ThreadPriorityVerbose) {
     char *thrtyp;
-    switch ( thr_type ) {
+    switch (thr_type) {
       case vm_thread:
         thrtyp = (char *)"vm";
         break;
@@ -1207,11 +1207,11 @@
 
 // First crack at OS-specific initialization, from inside the new thread.
 void os::initialize_thread(Thread* thr) {
-  int r = thr_main() ;
-  guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
+  int r = thr_main();
+  guarantee(r == 0 || r == 1, "CR6501650 or CR6493689");
   if (r) {
     JavaThread* jt = (JavaThread *)thr;
-    assert(jt != NULL,"Sanity check");
+    assert(jt != NULL, "Sanity check");
     size_t stack_size;
     address base = jt->stack_base();
     if (Arguments::created_by_java_launcher()) {
@@ -1322,7 +1322,7 @@
   //           JavaThread in Java code, and have stubs simply
   //           treat %g2 as a caller-save register, preserving it in a %lN.
   thread_key_t tk;
-  if (thr_keycreate( &tk, NULL ) )
+  if (thr_keycreate( &tk, NULL))
     fatal(err_msg("os::allocate_thread_local_storage: thr_keycreate failed "
                   "(%s)", strerror(errno)));
   return int(tk);
@@ -1347,7 +1347,7 @@
                     "(%s)", strerror(errno)));
     }
   } else {
-      ThreadLocalStorage::set_thread_in_slot ((Thread *) value) ;
+      ThreadLocalStorage::set_thread_in_slot((Thread *) value);
   }
 }
 
@@ -1579,7 +1579,7 @@
     if (pelements == NULL) {
       return false;
     }
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       // really shouldn't be NULL but what the heck, check can't hurt
       if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
         continue; // skip the empty path values
@@ -1591,7 +1591,7 @@
       }
     }
     // release the storage
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
         FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
       }
@@ -1795,7 +1795,7 @@
 
   bool failed_to_read_elf_head=
     (sizeof(elf_head)!=
-        (::read(file_descriptor, &elf_head,sizeof(elf_head)))) ;
+        (::read(file_descriptor, &elf_head,sizeof(elf_head))));
 
   ::close(file_descriptor);
   if (failed_to_read_elf_head) {
@@ -1851,7 +1851,7 @@
   arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
   int running_arch_index=-1;
 
-  for (unsigned int i=0 ; i < ARRAY_SIZE(arch_array) ; i++ ) {
+  for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
     if (running_arch_code == arch_array[i].code) {
       running_arch_index    = i;
     }
@@ -1880,7 +1880,7 @@
   }
 
   if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) {
-    if ( lib_arch.name!=NULL ) {
+    if (lib_arch.name!=NULL) {
       ::snprintf(diag_msg_buf, diag_msg_max_length-1,
         " (Possible cause: can't load %s-bit .so on a %s-bit platform)",
         lib_arch.name, arch_array[running_arch_index].name);
@@ -1969,7 +1969,7 @@
   int fd = ::open("/proc/self/map",O_RDONLY);
   if (fd >= 0) {
     prmap_t p;
-    while(::read(fd, &p, sizeof(p)) > 0) {
+    while (::read(fd, &p, sizeof(p)) > 0) {
       if (p.pr_vaddr == 0x0) {
         st->print("Warning: Address: 0x%x, Size: %dK, ",p.pr_vaddr, p.pr_size/1024, p.pr_mapname);
         st->print("Mapped file: %s, ", p.pr_mapname[0] == '\0' ? "None" : p.pr_mapname);
@@ -2079,7 +2079,7 @@
 
   address rh = VMError::get_resetted_sighandler(sig);
   // May be, handler was resetted by VMError?
-  if(rh != NULL) {
+  if (rh != NULL) {
     handler = rh;
     sa.sa_flags = VMError::get_resetted_sigflags(sig);
   }
@@ -2088,11 +2088,11 @@
   os::Posix::print_sa_flags(st, sa.sa_flags);
 
   // Check: is it our handler?
-  if(handler == CAST_FROM_FN_PTR(address, signalHandler) ||
+  if (handler == CAST_FROM_FN_PTR(address, signalHandler) ||
      handler == CAST_FROM_FN_PTR(address, sigINTRHandler)) {
     // It is our signal handler
     // check for flags
-    if(sa.sa_flags != os::Solaris::get_our_sigflags(sig)) {
+    if (sa.sa_flags != os::Solaris::get_our_sigflags(sig)) {
       st->print(
         ", flags was changed from " PTR32_FORMAT ", consider using jsig library",
         os::Solaris::get_our_sigflags(sig));
@@ -2403,7 +2403,7 @@
     do {
       thread->set_suspend_equivalent();
       // cleared by handle_special_suspend_equivalent_condition() or java_suspend_self()
-      while((ret = ::sema_wait(&sig_sem)) == EINTR)
+      while ((ret = ::sema_wait(&sig_sem)) == EINTR)
           ;
       assert(ret == 0, "sema_wait() failed");
 
@@ -2635,7 +2635,7 @@
      }
      if (!r) {
        // That's a leaf node.
-       assert (bottom <= cur, "Sanity check");
+       assert(bottom <= cur, "Sanity check");
        // Check if the node has memory
        if (Solaris::lgrp_resources(Solaris::lgrp_cookie(), ids[cur],
                                    NULL, 0, LGRP_RSRC_MEM) > 0) {
@@ -3051,7 +3051,7 @@
   const size_t size_limit =
     FLAG_IS_DEFAULT(LargePageSizeInBytes) ? 4 * M : LargePageSizeInBytes;
   int beg;
-  for (beg = 0; beg < n && _page_sizes[beg] > size_limit; ++beg) /* empty */ ;
+  for (beg = 0; beg < n && _page_sizes[beg] > size_limit; ++beg) /* empty */;
   const int end = MIN2((int)usable_count, n) - 1;
   for (int cur = 0; cur < end; ++cur, ++beg) {
     _page_sizes[cur] = _page_sizes[beg];
@@ -3264,7 +3264,7 @@
 //
 // Return errno or 0 if OK.
 //
-static int lwp_priocntl_init () {
+static int lwp_priocntl_init() {
   int rslt;
   pcinfo_t ClassInfo;
   pcparms_t ParmInfo;
@@ -3274,7 +3274,7 @@
 
   // If ThreadPriorityPolicy is 1, switch tables
   if (ThreadPriorityPolicy == 1) {
-    for (i = 0 ; i < CriticalPriority+1; i++)
+    for (i = 0; i < CriticalPriority+1; i++)
       os::java_to_os_priority[i] = prio_policy1[i];
   }
   if (UseCriticalJavaThreadPriority) {
@@ -3373,12 +3373,12 @@
   } else {
     // No clue - punt
     if (ThreadPriorityVerbose)
-      tty->print_cr ("Unknown scheduling class: %s ... \n", ClassInfo.pc_clname);
+      tty->print_cr("Unknown scheduling class: %s ... \n", ClassInfo.pc_clname);
     return EINVAL;      // no clue, punt
   }
 
   if (ThreadPriorityVerbose) {
-    tty->print_cr ("Thread priority Range: [%d..%d]\n", myMin, myMax);
+    tty->print_cr("Thread priority Range: [%d..%d]\n", myMin, myMax);
   }
 
   priocntl_enable = true;  // Enable changing priorities
@@ -3424,7 +3424,7 @@
   // TODO: elide set-to-same-value
 
   // If something went wrong on init, don't change priorities.
-  if ( !priocntl_enable ) {
+  if (!priocntl_enable) {
     if (ThreadPriorityVerbose)
       tty->print_cr("Trying to set priority but init failed, ignoring");
     return EINVAL;
@@ -3432,9 +3432,9 @@
 
   // If lwp hasn't started yet, just return
   // the _start routine will call us again.
-  if ( lwpid <= 0 ) {
+  if (lwpid <= 0) {
     if (ThreadPriorityVerbose) {
-      tty->print_cr ("deferring the set_lwp_class_and_priority of thread "
+      tty->print_cr("deferring the set_lwp_class_and_priority of thread "
                      INTPTR_FORMAT " to %d, lwpid not set",
                      ThreadID, newPrio);
     }
@@ -3653,7 +3653,7 @@
 
 OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
   int p;
-  if ( !UseThreadPriorities ) {
+  if (!UseThreadPriorities) {
     *priority_ptr = NormalPriority;
     return OS_OK;
   }
@@ -4099,7 +4099,7 @@
 void os::run_periodic_checks() {
   // A big source of grief is hijacking virt. addr 0x0 on Solaris,
   // thereby preventing a NULL checks.
-  if(!check_addr0_done) check_addr0_done = check_addr0(tty);
+  if (!check_addr0_done) check_addr0_done = check_addr0(tty);
 
   if (check_signals == false) return;
 
@@ -4148,10 +4148,10 @@
 
   address thisHandler = (act.sa_flags & SA_SIGINFO)
     ? CAST_FROM_FN_PTR(address, act.sa_sigaction)
-    : CAST_FROM_FN_PTR(address, act.sa_handler) ;
-
-
-  switch(sig) {
+    : CAST_FROM_FN_PTR(address, act.sa_handler);
+
+
+  switch (sig) {
     case SIGSEGV:
     case SIGBUS:
     case SIGFPE:
@@ -4332,7 +4332,7 @@
 
 static address resolve_symbol_lazy(const char* name) {
   address addr = (address) dlsym(RTLD_DEFAULT, name);
-  if(addr == NULL) {
+  if (addr == NULL) {
     // RTLD_DEFAULT was not defined on some early versions of 2.5.1
     addr = (address) dlsym(RTLD_NEXT, name);
   }
@@ -4341,7 +4341,7 @@
 
 static address resolve_symbol(const char* name) {
   address addr = resolve_symbol_lazy(name);
-  if(addr == NULL) {
+  if (addr == NULL) {
     fatal(dlerror());
   }
   return addr;
@@ -4353,7 +4353,7 @@
   lwp_priocntl_init();
 
   // RTLD_DEFAULT was not defined on some early versions of 5.5.1
-  if(func == NULL) {
+  if (func == NULL) {
     func = (address) dlsym(RTLD_NEXT, "_thr_suspend_allmutators");
     // Guarantee that this VM is running on an new enough OS (5.6 or
     // later) that it will have a new enough libthread.so.
@@ -4384,7 +4384,7 @@
 int os::Solaris::_cond_scope = USYNC_THREAD;
 
 void os::Solaris::synchronization_init() {
-  if(UseLWPSynchronization) {
+  if (UseLWPSynchronization) {
     os::Solaris::set_mutex_lock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("_lwp_mutex_lock")));
     os::Solaris::set_mutex_trylock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("_lwp_mutex_trylock")));
     os::Solaris::set_mutex_unlock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("_lwp_mutex_unlock")));
@@ -4404,7 +4404,7 @@
     os::Solaris::set_mutex_scope(USYNC_THREAD);
     os::Solaris::set_cond_scope(USYNC_THREAD);
 
-    if(UsePthreads) {
+    if (UsePthreads) {
       os::Solaris::set_mutex_lock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("pthread_mutex_lock")));
       os::Solaris::set_mutex_trylock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("pthread_mutex_trylock")));
       os::Solaris::set_mutex_unlock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("pthread_mutex_unlock")));
@@ -4576,17 +4576,17 @@
   os::set_polling_page(polling_page);
 
 #ifndef PRODUCT
-  if( Verbose && PrintMiscellaneous )
+  if (Verbose && PrintMiscellaneous)
     tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
 #endif
 
   if (!UseMembar) {
-    address mem_serialize_page = (address)Solaris::mmap_chunk( NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE );
-    guarantee( mem_serialize_page != NULL, "mmap Failed for memory serialize page");
-    os::set_memory_serialize_page( mem_serialize_page );
+    address mem_serialize_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE);
+    guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
+    os::set_memory_serialize_page(mem_serialize_page);
 
 #ifndef PRODUCT
-    if(Verbose && PrintMiscellaneous)
+    if (Verbose && PrintMiscellaneous)
       tty->print("[Memory Serialize  Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
 #endif
   }
@@ -4725,13 +4725,13 @@
 
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
-  if( mprotect((char *)_polling_page, page_size, PROT_NONE) != 0 )
+  if (mprotect((char *)_polling_page, page_size, PROT_NONE) != 0)
     fatal("Could not disable polling page");
 };
 
 // Mark the polling page as readable
 void os::make_polling_page_readable(void) {
-  if( mprotect((char *)_polling_page, page_size, PROT_READ) != 0 )
+  if (mprotect((char *)_polling_page, page_size, PROT_READ) != 0)
     fatal("Could not enable polling page");
 };
 
@@ -5221,7 +5221,7 @@
                      getpid(),
                      thread->osthread()->lwp_id());
   fd = ::open(proc_name, O_RDONLY);
-  if ( fd == -1 ) return -1;
+  if (fd == -1) return -1;
 
   do {
     count = ::pread(fd,
@@ -5230,7 +5230,7 @@
                   thr_time_off);
   } while (count < 0 && errno == EINTR);
   ::close(fd);
-  if ( count < 0 ) return -1;
+  if (count < 0) return -1;
 
   if (user_sys_cpu_time) {
     // user + system CPU time
@@ -5244,7 +5244,7 @@
                 (jlong)prusage.pr_utime.tv_nsec;
   }
 
-  return(lwp_time);
+  return (lwp_time);
 }
 
 void os::current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr) {
@@ -5448,43 +5448,43 @@
 
 int os::PlatformEvent::TryPark() {
   for (;;) {
-    const int v = _Event ;
-    guarantee ((v == 0) || (v == 1), "invariant") ;
-    if (Atomic::cmpxchg (0, &_Event, v) == v) return v  ;
+    const int v = _Event;
+    guarantee((v == 0) || (v == 1), "invariant");
+    if (Atomic::cmpxchg(0, &_Event, v) == v) return v;
   }
 }
 
 void os::PlatformEvent::park() {           // AKA: down()
   // Invariant: Only the thread associated with the Event/PlatformEvent
   // may call park().
-  int v ;
+  int v;
   for (;;) {
-      v = _Event ;
-      if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
-  }
-  guarantee (v >= 0, "invariant") ;
+      v = _Event;
+      if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
+  }
+  guarantee(v >= 0, "invariant");
   if (v == 0) {
      // Do this the hard way by blocking ...
      // See http://monaco.sfbay/detail.jsf?cr=5094058.
      // TODO-FIXME: for Solaris SPARC set fprs.FEF=0 prior to parking.
      // Only for SPARC >= V8PlusA
 #if defined(__sparc) && defined(COMPILER2)
-     if (ClearFPUAtPark) { _mark_fpu_nosave() ; }
+     if (ClearFPUAtPark) { _mark_fpu_nosave(); }
 #endif
      int status = os::Solaris::mutex_lock(_mutex);
-     assert_status(status == 0, status,  "mutex_lock");
-     guarantee (_nParked == 0, "invariant") ;
-     ++ _nParked ;
+     assert_status(status == 0, status, "mutex_lock");
+     guarantee(_nParked == 0, "invariant");
+     ++_nParked;
      while (_Event < 0) {
         // for some reason, under 2.7 lwp_cond_wait() may return ETIME ...
         // Treat this the same as if the wait was interrupted
         // With usr/lib/lwp going to kernel, always handle ETIME
         status = os::Solaris::cond_wait(_cond, _mutex);
-        if (status == ETIME) status = EINTR ;
+        if (status == ETIME) status = EINTR;
         assert_status(status == 0 || status == EINTR, status, "cond_wait");
      }
-     -- _nParked ;
-     _Event = 0 ;
+     --_nParked;
+     _Event = 0;
      status = os::Solaris::mutex_unlock(_mutex);
      assert_status(status == 0, status, "mutex_unlock");
     // Paranoia to ensure our locked and lock-free paths interact
@@ -5494,41 +5494,41 @@
 }
 
 int os::PlatformEvent::park(jlong millis) {
-  guarantee (_nParked == 0, "invariant") ;
-  int v ;
+  guarantee(_nParked == 0, "invariant");
+  int v;
   for (;;) {
-      v = _Event ;
-      if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
-  }
-  guarantee (v >= 0, "invariant") ;
-  if (v != 0) return OS_OK ;
+      v = _Event;
+      if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
+  }
+  guarantee(v >= 0, "invariant");
+  if (v != 0) return OS_OK;
 
   int ret = OS_TIMEOUT;
   timestruc_t abst;
-  compute_abstime (&abst, millis);
+  compute_abstime(&abst, millis);
 
   // See http://monaco.sfbay/detail.jsf?cr=5094058.
   // For Solaris SPARC set fprs.FEF=0 prior to parking.
   // Only for SPARC >= V8PlusA
 #if defined(__sparc) && defined(COMPILER2)
- if (ClearFPUAtPark) { _mark_fpu_nosave() ; }
+ if (ClearFPUAtPark) { _mark_fpu_nosave(); }
 #endif
   int status = os::Solaris::mutex_lock(_mutex);
   assert_status(status == 0, status, "mutex_lock");
-  guarantee (_nParked == 0, "invariant") ;
-  ++ _nParked ;
+  guarantee(_nParked == 0, "invariant");
+  ++_nParked;
   while (_Event < 0) {
      int status = os::Solaris::cond_timedwait(_cond, _mutex, &abst);
      assert_status(status == 0 || status == EINTR ||
                    status == ETIME || status == ETIMEDOUT,
                    status, "cond_timedwait");
-     if (!FilterSpuriousWakeups) break ;                // previous semantics
-     if (status == ETIME || status == ETIMEDOUT) break ;
+     if (!FilterSpuriousWakeups) break;                // previous semantics
+     if (status == ETIME || status == ETIMEDOUT) break;
      // We consume and ignore EINTR and spurious wakeups.
   }
-  -- _nParked ;
-  if (_Event >= 0) ret = OS_OK ;
-  _Event = 0 ;
+  --_nParked;
+  if (_Event >= 0) ret = OS_OK;
+  _Event = 0;
   status = os::Solaris::mutex_unlock(_mutex);
   assert_status(status == 0, status, "mutex_unlock");
   // Paranoia to ensure our locked and lock-free paths interact
@@ -5605,7 +5605,7 @@
  * years from "now".
  */
 static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) {
-  assert (time > 0, "convertTime");
+  assert(time > 0, "convertTime");
 
   struct timeval now;
   int status = gettimeofday(&now, NULL);
@@ -5664,7 +5664,7 @@
 
   // First, demultiplex/decode time arguments
   timespec absTime;
-  if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
+  if (time < 0 || (isAbsolute && time == 0)) { // don't wait at all
     return;
   }
   if (time > 0) {
@@ -5688,12 +5688,12 @@
     return;
   }
 
-  int status ;
+  int status;
 
   if (_counter > 0)  { // no wait needed
     _counter = 0;
     status = os::Solaris::mutex_unlock(_mutex);
-    assert (status == 0, "invariant") ;
+    assert(status == 0, "invariant");
     // Paranoia to ensure our locked and lock-free paths interact
     // correctly with each other and Java-level accesses.
     OrderAccess::fence();
@@ -5717,11 +5717,11 @@
   // TODO-FIXME: for Solaris SPARC set fprs.FEF=0 prior to parking.
   // Only for SPARC >= V8PlusA
 #if defined(__sparc) && defined(COMPILER2)
-  if (ClearFPUAtPark) { _mark_fpu_nosave() ; }
+  if (ClearFPUAtPark) { _mark_fpu_nosave(); }
 #endif
 
   if (time == 0) {
-    status = os::Solaris::cond_wait (_cond, _mutex) ;
+    status = os::Solaris::cond_wait(_cond, _mutex);
   } else {
     status = os::Solaris::cond_timedwait (_cond, _mutex, &absTime);
   }
@@ -5734,9 +5734,9 @@
 #ifdef ASSERT
   thr_sigsetmask(SIG_SETMASK, &oldsigs, NULL);
 #endif
-  _counter = 0 ;
+  _counter = 0;
   status = os::Solaris::mutex_unlock(_mutex);
-  assert_status(status == 0, status, "mutex_unlock") ;
+  assert_status(status == 0, status, "mutex_unlock");
   // Paranoia to ensure our locked and lock-free paths interact
   // correctly with each other and Java-level accesses.
   OrderAccess::fence();
@@ -5748,17 +5748,17 @@
 }
 
 void Parker::unpark() {
-  int s, status ;
-  status = os::Solaris::mutex_lock (_mutex) ;
-  assert (status == 0, "invariant") ;
+  int s, status;
+  status = os::Solaris::mutex_lock(_mutex);
+  assert(status == 0, "invariant");
   s = _counter;
   _counter = 1;
-  status = os::Solaris::mutex_unlock (_mutex) ;
-  assert (status == 0, "invariant") ;
+  status = os::Solaris::mutex_unlock(_mutex);
+  assert(status == 0, "invariant");
 
   if (s < 1) {
-    status = os::Solaris::cond_signal (_cond) ;
-    assert (status == 0, "invariant") ;
+    status = os::Solaris::cond_signal(_cond);
+    assert(status == 0, "invariant");
   }
 }
 
@@ -5925,14 +5925,14 @@
   gettimeofday(&t, &aNull);
   prevtime = ((julong)t.tv_sec * 1000)  +  t.tv_usec / 1000;
 
-  for(;;) {
+  for (;;) {
     res = ::poll(&pfd, 1, timeout);
-    if(res == OS_ERR && errno == EINTR) {
-        if(timeout != -1) {
+    if (res == OS_ERR && errno == EINTR) {
+        if (timeout != -1) {
           gettimeofday(&t, &aNull);
           newtime = ((julong)t.tv_sec * 1000)  +  t.tv_usec /1000;
           timeout -= newtime - prevtime;
-          if(timeout <= 0)
+          if (timeout <= 0)
             return OS_OK;
           prevtime = newtime;
         }
--- a/hotspot/src/os/solaris/vm/os_solaris.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -301,48 +301,48 @@
 
 class PlatformEvent : public CHeapObj<mtInternal> {
   private:
-    double CachePad [4] ;   // increase odds that _mutex is sole occupant of cache line
-    volatile int _Event ;
-    int _nParked ;
-    int _pipev [2] ;
-    mutex_t _mutex  [1] ;
-    cond_t  _cond   [1] ;
-    double PostPad  [2] ;
+    double CachePad[4];   // increase odds that _mutex is sole occupant of cache line
+    volatile int _Event;
+    int _nParked;
+    int _pipev[2];
+    mutex_t _mutex[1];
+    cond_t  _cond[1];
+    double PostPad[2];
 
   protected:
     // Defining a protected ctor effectively gives us an abstract base class.
     // That is, a PlatformEvent can never be instantiated "naked" but only
     // as a part of a ParkEvent (recall that ParkEvent extends PlatformEvent).
     // TODO-FIXME: make dtor private
-    ~PlatformEvent() { guarantee (0, "invariant") ; }
+    ~PlatformEvent() { guarantee(0, "invariant"); }
     PlatformEvent() {
       int status;
       status = os::Solaris::cond_init(_cond);
       assert_status(status == 0, status, "cond_init");
       status = os::Solaris::mutex_init(_mutex);
       assert_status(status == 0, status, "mutex_init");
-      _Event   = 0 ;
-      _nParked = 0 ;
-      _pipev[0] = _pipev[1] = -1 ;
+      _Event   = 0;
+      _nParked = 0;
+      _pipev[0] = _pipev[1] = -1;
     }
 
   public:
     // Exercise caution using reset() and fired() -- they may require MEMBARs
-    void reset() { _Event = 0 ; }
+    void reset() { _Event = 0; }
     int  fired() { return _Event; }
-    void park () ;
-    int  park (jlong millis) ;
-    int  TryPark () ;
-    void unpark () ;
-} ;
+    void park();
+    int  park(jlong millis);
+    int  TryPark();
+    void unpark();
+};
 
 class PlatformParker : public CHeapObj<mtInternal> {
   protected:
-    mutex_t _mutex [1] ;
-    cond_t  _cond  [1] ;
+    mutex_t _mutex[1];
+    cond_t  _cond[1];
 
   public:       // TODO-FIXME: make dtor private
-    ~PlatformParker() { guarantee (0, "invariant") ; }
+    ~PlatformParker() { guarantee(0, "invariant"); }
 
   public:
     PlatformParker() {
@@ -352,6 +352,6 @@
       status = os::Solaris::mutex_init(_mutex);
       assert_status(status == 0, status, "mutex_init");
     }
-} ;
+};
 
 #endif // OS_SOLARIS_VM_OS_SOLARIS_HPP
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -125,11 +125,11 @@
   switch (reason) {
     case DLL_PROCESS_ATTACH:
       vm_lib_handle = hinst;
-      if(ForceTimeHighResolution)
+      if (ForceTimeHighResolution)
         timeBeginPeriod(1L);
       break;
     case DLL_PROCESS_DETACH:
-      if(ForceTimeHighResolution)
+      if (ForceTimeHighResolution)
         timeEndPeriod(1L);
 
       // Workaround for issue when a custom launcher doesn't call
@@ -318,7 +318,7 @@
  */
 address os::get_caller_pc(int n) {
 #ifdef _NMT_NOINLINE_
-  n ++;
+  n++;
 #endif
   address pc;
   if (os::Kernel32Dll::RtlCaptureStackBackTrace(n + 1, 1, (PVOID*)&pc, NULL) == 1) {
@@ -345,10 +345,10 @@
 
   // Add up the sizes of all the regions with the same
   // AllocationBase.
-  while( 1 )
+  while (1)
   {
     VirtualQuery(stack_bottom+stack_size, &minfo, sizeof(minfo));
-    if ( stack_bottom == (address)minfo.AllocationBase )
+    if (stack_bottom == (address)minfo.AllocationBase)
       stack_size += minfo.RegionSize;
     else
       break;
@@ -644,7 +644,7 @@
 jlong as_long(LARGE_INTEGER x) {
   jlong result = 0; // initialization to avoid warning
   set_high(&result, x.HighPart);
-  set_low(&result,  x.LowPart);
+  set_low(&result, x.LowPart);
   return result;
 }
 
@@ -999,7 +999,7 @@
 #endif
 
   cwd = get_current_directory(NULL, 0);
-  jio_snprintf(buffer, bufferSize, "%s\\hs_err_pid%u.mdmp",cwd, current_process_id());
+  jio_snprintf(buffer, bufferSize, "%s\\hs_err_pid%u.mdmp", cwd, current_process_id());
   dumpFile = CreateFile(buffer, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
 
   if (dumpFile == INVALID_HANDLE_VALUE) {
@@ -1217,7 +1217,7 @@
     if (pelements == NULL) {
       return false;
     }
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       char* path = pelements[i];
       // Really shouldn't be NULL, but check can't hurt
       size_t plen = (path == NULL) ? 0 : strlen(path);
@@ -1236,7 +1236,7 @@
       }
     }
     // release the storage
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
         FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
       }
@@ -1271,12 +1271,12 @@
   MODULEINFO minfo;
 
   hmod = GetModuleHandle("NTDLL.DLL");
-  if ( hmod == NULL ) return false;
-  if ( !os::PSApiDll::GetModuleInformation( GetCurrentProcess(), hmod,
+  if (hmod == NULL) return false;
+  if (!os::PSApiDll::GetModuleInformation( GetCurrentProcess(), hmod,
                                &minfo, sizeof(MODULEINFO)) )
     return false;
 
-  if ( (addr >= minfo.lpBaseOfDll) &&
+  if ((addr >= minfo.lpBaseOfDll) &&
        (addr < (address)((uintptr_t)minfo.lpBaseOfDll + (uintptr_t)minfo.SizeOfImage)))
     return true;
   else
@@ -1304,11 +1304,11 @@
 // enumerate_modules for Windows NT, using PSAPI
 static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void * param)
 {
-  HANDLE   hProcess ;
+  HANDLE   hProcess;
 
 # define MAX_NUM_MODULES 128
   HMODULE     modules[MAX_NUM_MODULES];
-  static char filename[ MAX_PATH ];
+  static char filename[MAX_PATH];
   int         result = 0;
 
   if (!os::PSApiDll::PSApiAvailable()) {
@@ -1316,13 +1316,13 @@
   }
 
   hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
-                         FALSE, pid ) ;
+                         FALSE, pid);
   if (hProcess == NULL) return 0;
 
   DWORD size_needed;
   if (!os::PSApiDll::EnumProcessModules(hProcess, modules,
                            sizeof(modules), &size_needed)) {
-      CloseHandle( hProcess );
+      CloseHandle(hProcess);
       return 0;
   }
 
@@ -1331,7 +1331,7 @@
 
   for (int i = 0; i < MIN2(num_modules, MAX_NUM_MODULES); i++) {
     // Get Full pathname:
-    if(!os::PSApiDll::GetModuleFileNameEx(hProcess, modules[i],
+    if (!os::PSApiDll::GetModuleFileNameEx(hProcess, modules[i],
                              filename, sizeof(filename))) {
         filename[0] = '\0';
     }
@@ -1349,7 +1349,7 @@
     if (result) break;
   }
 
-  CloseHandle( hProcess ) ;
+  CloseHandle(hProcess);
   return result;
 }
 
@@ -1357,8 +1357,8 @@
 // enumerate_modules for Windows 95/98/ME, using TOOLHELP
 static int _enumerate_modules_windows( int pid, EnumModulesCallbackFunc func, void *param)
 {
-  HANDLE                hSnapShot ;
-  static MODULEENTRY32  modentry ;
+  HANDLE                hSnapShot;
+  static MODULEENTRY32  modentry;
   int                   result = 0;
 
   if (!os::Kernel32Dll::HelpToolsAvailable()) {
@@ -1366,22 +1366,22 @@
   }
 
   // Get a handle to a Toolhelp snapshot of the system
-  hSnapShot = os::Kernel32Dll::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid ) ;
-  if( hSnapShot == INVALID_HANDLE_VALUE ) {
-      return FALSE ;
+  hSnapShot = os::Kernel32Dll::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid);
+  if (hSnapShot == INVALID_HANDLE_VALUE) {
+      return FALSE;
   }
 
   // iterate through all modules
-  modentry.dwSize = sizeof(MODULEENTRY32) ;
+  modentry.dwSize = sizeof(MODULEENTRY32);
   bool not_done = os::Kernel32Dll::Module32First( hSnapShot, &modentry ) != 0;
 
-  while( not_done ) {
+  while (not_done) {
     // invoke the callback
     result=func(pid, modentry.szExePath, (address)modentry.modBaseAddr,
                 modentry.modBaseSize, param);
     if (result) break;
 
-    modentry.dwSize = sizeof(MODULEENTRY32) ;
+    modentry.dwSize = sizeof(MODULEENTRY32);
     not_done = os::Kernel32Dll::Module32Next( hSnapShot, &modentry ) != 0;
   }
 
@@ -1941,7 +1941,7 @@
 // that raises SIGTERM for the latter cases.
 //
 static BOOL WINAPI consoleHandler(DWORD event) {
-  switch(event) {
+  switch (event) {
     case CTRL_C_EVENT:
       if (is_error_reported()) {
         // Ctrl-C is pressed during error reporting, likely because the error
@@ -1965,7 +1965,7 @@
       HANDLE handle = GetProcessWindowStation();
       if (handle != NULL &&
           GetUserObjectInformation(handle, UOI_FLAGS, &flags,
-            sizeof( USEROBJECTFLAGS), NULL)) {
+            sizeof(USEROBJECTFLAGS), NULL)) {
         // If it is a non-interactive session, let next handler to deal
         // with it.
         if ((flags.dwFlags & WSF_VISIBLE) == 0) {
@@ -1991,7 +1991,7 @@
 
 // Return maximum OS signal used + 1 for internal use only
 // Used as exit signal for signal_thread
-int os::sigexitnum_pd(){
+int os::sigexitnum_pd() {
   return NSIG;
 }
 
@@ -2422,11 +2422,11 @@
   // process of write protecting the memory serialization page.
   // It write enables the page immediately after protecting it
   // so just return.
-  if ( exception_code == EXCEPTION_ACCESS_VIOLATION ) {
+  if (exception_code == EXCEPTION_ACCESS_VIOLATION) {
     JavaThread* thread = (JavaThread*) t;
     PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord;
     address addr = (address) exceptionRecord->ExceptionInformation[1];
-    if ( os::is_memory_serialize_page(thread, addr) ) {
+    if (os::is_memory_serialize_page(thread, addr)) {
       // Block current thread until the memory serialize page permission restored.
       os::block_on_serialize_page_trap();
       return EXCEPTION_CONTINUE_EXECUTION;
@@ -2543,7 +2543,7 @@
           //
           PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord;
           address addr = (address) exceptionRecord->ExceptionInformation[1];
-          if (addr > thread->stack_yellow_zone_base() && addr < thread->stack_base() ) {
+          if (addr > thread->stack_yellow_zone_base() && addr < thread->stack_base()) {
                   addr = (address)((uintptr_t)addr &
                          (~((uintptr_t)os::vm_page_size() - (uintptr_t)1)));
                   os::commit_memory((char *)addr, thread->stack_base() - addr,
@@ -2623,7 +2623,7 @@
       // Compiled method patched to be non entrant? Following conditions must apply:
       // 1. must be first instruction in bundle
       // 2. must be a break instruction with appropriate code
-      if((((uint64_t) pc & 0x0F) == 0) &&
+      if ((((uint64_t) pc & 0x0F) == 0) &&
          (((IPF_Bundle*) pc)->get_slot0() == handle_wrong_method_break.bits())) {
         return Handle_Exception(exceptionInfo,
                                 (address)SharedRuntime::get_handle_wrong_method_stub());
@@ -2794,7 +2794,7 @@
     return (_numa_used_node_count > 1);
   }
 
-  int get_count() {return _numa_used_node_count;}
+  int get_count() { return _numa_used_node_count; }
   int get_node_list_entry(int n) {
     // for indexes out of range, returns -1
     return (n < _numa_used_node_count ? _numa_used_node_list[n] : -1);
@@ -3112,14 +3112,14 @@
     res = (char*)VirtualAlloc(addr, bytes, MEM_RESERVE, PAGE_READWRITE);
   } else {
     elapsedTimer reserveTimer;
-    if( Verbose && PrintMiscellaneous ) reserveTimer.start();
+    if (Verbose && PrintMiscellaneous) reserveTimer.start();
     // in numa interleaving, we have to allocate pages individually
     // (well really chunks of NUMAInterleaveGranularity size)
     res = allocate_pages_individually(bytes, addr, MEM_RESERVE, PAGE_READWRITE);
     if (res == NULL) {
       warning("NUMA page allocation failed");
     }
-    if( Verbose && PrintMiscellaneous ) {
+    if (Verbose && PrintMiscellaneous) {
       reserveTimer.stop();
       tty->print_cr("reserve_memory of %Ix bytes took " JLONG_FORMAT " ms (" JLONG_FORMAT " ticks)", bytes,
                     reserveTimer.milliseconds(), reserveTimer.ticks());
@@ -3450,14 +3450,14 @@
 int os::sleep(Thread* thread, jlong ms, bool interruptable) {
   jlong limit = (jlong) MAXDWORD;
 
-  while(ms > limit) {
+  while (ms > limit) {
     int res;
     if ((res = sleep(thread, limit, interruptable)) != OS_TIMEOUT)
       return res;
     ms -= limit;
   }
 
-  assert(thread == Thread::current(),  "thread consistency check");
+  assert(thread == Thread::current(), "thread consistency check");
   OSThread* osthread = thread->osthread();
   OSThreadWaitState osts(osthread, false /* not Object.wait() */);
   int result;
@@ -3473,8 +3473,8 @@
     HANDLE events[1];
     events[0] = osthread->interrupt_event();
     HighResolutionInterval *phri=NULL;
-    if(!ForceTimeHighResolution)
-      phri = new HighResolutionInterval( ms );
+    if (!ForceTimeHighResolution)
+      phri = new HighResolutionInterval(ms);
     if (WaitForMultipleObjects(1, events, FALSE, (DWORD)ms) == WAIT_TIMEOUT) {
       result = OS_TIMEOUT;
     } else {
@@ -3511,17 +3511,17 @@
   }
 }
 
-typedef BOOL (WINAPI * STTSignature)(void) ;
+typedef BOOL (WINAPI * STTSignature)(void);
 
 os::YieldResult os::NakedYield() {
   // Use either SwitchToThread() or Sleep(0)
   // Consider passing back the return value from SwitchToThread().
   if (os::Kernel32Dll::SwitchToThreadAvailable()) {
-    return SwitchToThread() ? os::YIELD_SWITCHED : os::YIELD_NONEREADY ;
+    return SwitchToThread() ? os::YIELD_SWITCHED : os::YIELD_NONEREADY;
   } else {
     Sleep(0);
   }
-  return os::YIELD_UNKNOWN ;
+  return os::YIELD_UNKNOWN;
 }
 
 void os::yield() {  os::NakedYield(); }
@@ -3574,7 +3574,7 @@
     }
   }
   if (UseCriticalJavaThreadPriority) {
-    os::java_to_os_priority[MaxPriority] = os::java_to_os_priority[CriticalPriority] ;
+    os::java_to_os_priority[MaxPriority] = os::java_to_os_priority[CriticalPriority];
   }
   return 0;
 }
@@ -3586,7 +3586,7 @@
 }
 
 OSReturn os::get_native_priority(const Thread* const thread, int* priority_ptr) {
-  if ( !UseThreadPriorities ) {
+  if (!UseThreadPriorities) {
     *priority_ptr = java_to_os_priority[NormPriority];
     return OS_OK;
   }
@@ -3620,8 +3620,8 @@
   if (thread->is_Java_thread())
     ((JavaThread*)thread)->parker()->unpark();
 
-  ParkEvent * ev = thread->_ParkEvent ;
-  if (ev != NULL) ev->unpark() ;
+  ParkEvent * ev = thread->_ParkEvent;
+  if (ev != NULL) ev->unpark();
 
 }
 
@@ -3715,7 +3715,7 @@
   OSVERSIONINFOEX oi;
   oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
   GetVersionEx((OSVERSIONINFO*)&oi);
-  switch(oi.dwPlatformId) {
+  switch (oi.dwPlatformId) {
     case VER_PLATFORM_WIN32_WINDOWS: _is_nt = false; break;
     case VER_PLATFORM_WIN32_NT:
       _is_nt = true;
@@ -3898,29 +3898,29 @@
 jint os::init_2(void) {
   // Allocate a single page and mark it as readable for safepoint polling
   address polling_page = (address)VirtualAlloc(NULL, os::vm_page_size(), MEM_RESERVE, PAGE_READONLY);
-  guarantee( polling_page != NULL, "Reserve Failed for polling page");
+  guarantee(polling_page != NULL, "Reserve Failed for polling page");
 
   address return_page  = (address)VirtualAlloc(polling_page, os::vm_page_size(), MEM_COMMIT, PAGE_READONLY);
-  guarantee( return_page != NULL, "Commit Failed for polling page");
-
-  os::set_polling_page( polling_page );
+  guarantee(return_page != NULL, "Commit Failed for polling page");
+
+  os::set_polling_page(polling_page);
 
 #ifndef PRODUCT
-  if( Verbose && PrintMiscellaneous )
+  if (Verbose && PrintMiscellaneous)
     tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
 #endif
 
   if (!UseMembar) {
     address mem_serialize_page = (address)VirtualAlloc(NULL, os::vm_page_size(), MEM_RESERVE, PAGE_READWRITE);
-    guarantee( mem_serialize_page != NULL, "Reserve Failed for memory serialize page");
+    guarantee(mem_serialize_page != NULL, "Reserve Failed for memory serialize page");
 
     return_page  = (address)VirtualAlloc(mem_serialize_page, os::vm_page_size(), MEM_COMMIT, PAGE_READWRITE);
-    guarantee( return_page != NULL, "Commit Failed for memory serialize page");
-
-    os::set_memory_serialize_page( mem_serialize_page );
+    guarantee(return_page != NULL, "Commit Failed for memory serialize page");
+
+    os::set_memory_serialize_page(mem_serialize_page);
 
 #ifndef PRODUCT
-    if(Verbose && PrintMiscellaneous)
+    if (Verbose && PrintMiscellaneous)
       tty->print("[Memory Serialize  Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
 #endif
   }
@@ -4036,14 +4036,14 @@
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
   DWORD old_status;
-  if( !VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_NOACCESS, &old_status) )
+  if (!VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_NOACCESS, &old_status))
     fatal("Could not disable polling page");
 };
 
 // Mark the polling page as readable
 void os::make_polling_page_readable(void) {
   DWORD old_status;
-  if( !VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_READONLY, &old_status) )
+  if (!VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_READONLY, &old_status))
     fatal("Could not enable polling page");
 };
 
@@ -4121,7 +4121,7 @@
     FILETIME KernelTime;
     FILETIME UserTime;
 
-    if ( GetThreadTimes(thread->osthread()->thread_handle(),
+    if (GetThreadTimes(thread->osthread()->thread_handle(),
                     &CreationTime, &ExitTime, &KernelTime, &UserTime) == 0)
       return -1;
     else
@@ -4157,7 +4157,7 @@
     FILETIME KernelTime;
     FILETIME UserTime;
 
-    if ( GetThreadTimes(GetCurrentThread(),
+    if (GetThreadTimes(GetCurrentThread(),
                     &CreationTime, &ExitTime, &KernelTime, &UserTime) == 0)
       return false;
     else
@@ -4391,7 +4391,7 @@
 int os::fsync(int fd) {
   HANDLE handle = (HANDLE)::_get_osfhandle(fd);
 
-  if ( (!::FlushFileBuffers(handle)) &&
+  if ((!::FlushFileBuffers(handle)) &&
          (GetLastError() != ERROR_ACCESS_DENIED) ) {
     /* from winerror.h */
     return -1;
@@ -4512,7 +4512,7 @@
   }
 
   /* Examine input records for the number of bytes available */
-  for(i=0; i<numEvents; i++) {
+  for (i=0; i<numEvents; i++) {
     if (lpBuffer[i].EventType == KEY_EVENT) {
 
       KEY_EVENT_RECORD *keyRecord = (KEY_EVENT_RECORD *)
@@ -4527,7 +4527,7 @@
     }
   }
 
-  if(lpBuffer != NULL) {
+  if (lpBuffer != NULL) {
     os::free(lpBuffer, mtInternal);
   }
 
@@ -4790,19 +4790,19 @@
 // with explicit "PARKED" and "SIGNALED" bits.
 
 int os::PlatformEvent::park (jlong Millis) {
-    guarantee (_ParkHandle != NULL , "Invariant") ;
-    guarantee (Millis > 0          , "Invariant") ;
-    int v ;
+    guarantee(_ParkHandle != NULL , "Invariant");
+    guarantee(Millis > 0          , "Invariant");
+    int v;
 
     // CONSIDER: defer assigning a CreateEvent() handle to the Event until
     // the initial park() operation.
 
     for (;;) {
-        v = _Event ;
-        if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
+        v = _Event;
+        if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
     }
-    guarantee ((v == 0) || (v == 1), "invariant") ;
-    if (v != 0) return OS_OK ;
+    guarantee((v == 0) || (v == 1), "invariant");
+    if (v != 0) return OS_OK;
 
     // Do this the hard way by blocking ...
     // TODO: consider a brief spin here, gated on the success of recent
@@ -4820,59 +4820,59 @@
     // In the future, however, we might want to track the accumulated wait time and
     // adjust Millis accordingly if we encounter a spurious wakeup.
 
-    const int MAXTIMEOUT = 0x10000000 ;
-    DWORD rv = WAIT_TIMEOUT ;
+    const int MAXTIMEOUT = 0x10000000;
+    DWORD rv = WAIT_TIMEOUT;
     while (_Event < 0 && Millis > 0) {
-       DWORD prd = Millis ;     // set prd = MAX (Millis, MAXTIMEOUT)
+       DWORD prd = Millis;     // set prd = MAX (Millis, MAXTIMEOUT)
        if (Millis > MAXTIMEOUT) {
-          prd = MAXTIMEOUT ;
+          prd = MAXTIMEOUT;
        }
-       rv = ::WaitForSingleObject (_ParkHandle, prd) ;
-       assert (rv == WAIT_OBJECT_0 || rv == WAIT_TIMEOUT, "WaitForSingleObject failed") ;
+       rv = ::WaitForSingleObject(_ParkHandle, prd);
+       assert(rv == WAIT_OBJECT_0 || rv == WAIT_TIMEOUT, "WaitForSingleObject failed");
        if (rv == WAIT_TIMEOUT) {
-           Millis -= prd ;
+           Millis -= prd;
        }
     }
-    v = _Event ;
-    _Event = 0 ;
+    v = _Event;
+    _Event = 0;
     // see comment at end of os::PlatformEvent::park() below:
-    OrderAccess::fence() ;
+    OrderAccess::fence();
     // If we encounter a nearly simultanous timeout expiry and unpark()
     // we return OS_OK indicating we awoke via unpark().
     // Implementor's license -- returning OS_TIMEOUT would be equally valid, however.
-    return (v >= 0) ? OS_OK : OS_TIMEOUT ;
-}
-
-void os::PlatformEvent::park () {
-    guarantee (_ParkHandle != NULL, "Invariant") ;
+    return (v >= 0) ? OS_OK : OS_TIMEOUT;
+}
+
+void os::PlatformEvent::park() {
+    guarantee(_ParkHandle != NULL, "Invariant");
     // Invariant: Only the thread associated with the Event/PlatformEvent
     // may call park().
-    int v ;
+    int v;
     for (;;) {
-        v = _Event ;
-        if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
+        v = _Event;
+        if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
     }
-    guarantee ((v == 0) || (v == 1), "invariant") ;
-    if (v != 0) return ;
+    guarantee((v == 0) || (v == 1), "invariant");
+    if (v != 0) return;
 
     // Do this the hard way by blocking ...
     // TODO: consider a brief spin here, gated on the success of recent
     // spin attempts by this thread.
     while (_Event < 0) {
-       DWORD rv = ::WaitForSingleObject (_ParkHandle, INFINITE) ;
-       assert (rv == WAIT_OBJECT_0, "WaitForSingleObject failed") ;
+       DWORD rv = ::WaitForSingleObject(_ParkHandle, INFINITE);
+       assert(rv == WAIT_OBJECT_0, "WaitForSingleObject failed");
     }
 
     // Usually we'll find _Event == 0 at this point, but as
     // an optional optimization we clear it, just in case can
     // multiple unpark() operations drove _Event up to 1.
-    _Event = 0 ;
-    OrderAccess::fence() ;
-    guarantee (_Event >= 0, "invariant") ;
+    _Event = 0;
+    OrderAccess::fence();
+    guarantee(_Event >= 0, "invariant");
 }
 
 void os::PlatformEvent::unpark() {
-  guarantee (_ParkHandle != NULL, "Invariant") ;
+  guarantee(_ParkHandle != NULL, "Invariant");
 
   // Transitions for _Event:
   //    0 :=> 1
@@ -4907,7 +4907,7 @@
 
 
 void Parker::park(bool isAbsolute, jlong time) {
-  guarantee (_ParkEvent != NULL, "invariant") ;
+  guarantee(_ParkEvent != NULL, "invariant");
   // First, demultiplex/decode time arguments
   if (time < 0) { // don't wait
     return;
@@ -4941,7 +4941,7 @@
     OSThreadWaitState osts(thread->osthread(), false /* not Object.wait() */);
     jt->set_suspend_equivalent();
 
-    WaitForSingleObject(_ParkEvent,  time);
+    WaitForSingleObject(_ParkEvent, time);
     ResetEvent(_ParkEvent);
 
     // If externally suspended while waiting, re-suspend
@@ -4952,7 +4952,7 @@
 }
 
 void Parker::unpark() {
-  guarantee (_ParkEvent != NULL, "invariant") ;
+  guarantee(_ParkEvent != NULL, "invariant");
   SetEvent(_ParkEvent);
 }
 
@@ -5040,7 +5040,7 @@
 LONG WINAPI os::win32::serialize_fault_filter(struct _EXCEPTION_POINTERS* e) {
   DWORD exception_code = e->ExceptionRecord->ExceptionCode;
 
-  if ( exception_code == EXCEPTION_ACCESS_VIOLATION ) {
+  if (exception_code == EXCEPTION_ACCESS_VIOLATION) {
     JavaThread* thread = (JavaThread*)ThreadLocalStorage::get_thread_slow();
     PEXCEPTION_RECORD exceptionRecord = e->ExceptionRecord;
     address addr = (address) exceptionRecord->ExceptionInformation[1];
--- a/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -55,7 +55,7 @@
 
   if (detect_niagara()) {
     NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Detected Linux on Niagara");)
-    features = niagara1_m;
+    features = niagara1_m | T_family_m;
   }
 
   return features;
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -2984,9 +2984,12 @@
       } else if (tag == vmSymbols::tag_enclosing_method()) {
         if (parsed_enclosingmethod_attribute) {
           classfile_parse_error("Multiple EnclosingMethod attributes in class file %s", CHECK);
-        }   else {
+        } else {
           parsed_enclosingmethod_attribute = true;
         }
+        guarantee_property(attribute_length == 4,
+          "Wrong EnclosingMethod attribute length %u in class file %s",
+          attribute_length, CHECK);
         cfs->guarantee_more(4, CHECK);  // class_index, method_index
         enclosing_method_class_index  = cfs->get_u2_fast();
         enclosing_method_method_index = cfs->get_u2_fast();
@@ -4067,6 +4070,11 @@
     this_klass->set_major_version(major_version);
     this_klass->set_has_default_methods(has_default_methods);
 
+    if (!host_klass.is_null()) {
+      assert (this_klass->is_anonymous(), "should be the same");
+      this_klass->set_host_klass(host_klass());
+    }
+
     // Set up Method*::intrinsic_id as soon as we know the names of methods.
     // (We used to do this lazily, but now we query it in Rewriter,
     // which is eagerly done for every method, so we might as well do it now,
@@ -4664,9 +4672,7 @@
 }
 
 bool ClassFileParser::is_supported_version(u2 major, u2 minor) {
-  u2 max_version =
-    JDK_Version::is_gte_jdk17x_version() ? JAVA_MAX_SUPPORTED_VERSION :
-    (JDK_Version::is_gte_jdk16x_version() ? JAVA_6_VERSION : JAVA_1_5_VERSION);
+  u2 max_version = JAVA_MAX_SUPPORTED_VERSION;
   return (major >= JAVA_MIN_SUPPORTED_VERSION) &&
          (major <= max_version) &&
          ((major != max_version) ||
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -1126,7 +1126,7 @@
 
 
 // JDK 1.3 version
-typedef struct real_jzentry13 {         /* Zip file entry */
+typedef struct real_jzentry {         /* Zip file entry */
     char *name;                 /* entry name */
     jint time;                  /* modification time */
     jint size;                  /* size of uncompressed data */
@@ -1135,9 +1135,9 @@
     char *comment;              /* optional zip file comment */
     jbyte *extra;               /* optional extra data */
     jint pos;                   /* position of LOC header (if negative) or data */
-} real_jzentry13;
+} real_jzentry;
 
-typedef struct real_jzfile13 {  /* Zip file */
+typedef struct real_jzfile {  /* Zip file */
     char *name;                 /* zip file name */
     jint refs;                  /* number of active references */
     jint fd;                    /* open file descriptor */
@@ -1148,42 +1148,14 @@
     jint total;                 /* total number of entries */
     unsigned short *table;      /* Hash chain heads: indexes into entries */
     jint tablelen;              /* number of hash eads */
-    real_jzfile13 *next;        /* next zip file in search list */
+    real_jzfile *next;        /* next zip file in search list */
     jzentry *cache;             /* we cache the most recently freed jzentry */
     /* Information on metadata names in META-INF directory */
     char **metanames;           /* array of meta names (may have null names) */
     jint metacount;             /* number of slots in metanames array */
     /* If there are any per-entry comments, they are in the comments array */
     char **comments;
-} real_jzfile13;
-
-// JDK 1.2 version
-typedef struct real_jzentry12 {  /* Zip file entry */
-    char *name;                  /* entry name */
-    jint time;                   /* modification time */
-    jint size;                   /* size of uncompressed data */
-    jint csize;                  /* size of compressed data (zero if uncompressed) */
-    jint crc;                    /* crc of uncompressed data */
-    char *comment;               /* optional zip file comment */
-    jbyte *extra;                /* optional extra data */
-    jint pos;                    /* position of LOC header (if negative) or data */
-    struct real_jzentry12 *next; /* next entry in hash table */
-} real_jzentry12;
-
-typedef struct real_jzfile12 {  /* Zip file */
-    char *name;                 /* zip file name */
-    jint refs;                  /* number of active references */
-    jint fd;                    /* open file descriptor */
-    void *lock;                 /* read lock */
-    char *comment;              /* zip file comment */
-    char *msg;                  /* zip error message */
-    real_jzentry12 *entries;    /* array of zip entries */
-    jint total;                 /* total number of entries */
-    real_jzentry12 **table;     /* hash table of entries */
-    jint tablelen;              /* number of buckets */
-    jzfile *next;               /* next zip file in search list */
-} real_jzfile12;
-
+} real_jzfile;
 
 void ClassPathDirEntry::compile_the_world(Handle loader, TRAPS) {
   // For now we only compile all methods in all classes in zip/jar files
@@ -1197,10 +1169,14 @@
 }
 
 void ClassPathZipEntry::compile_the_world(Handle loader, TRAPS) {
-  if (JDK_Version::is_jdk12x_version()) {
-    compile_the_world12(loader, THREAD);
-  } else {
-    compile_the_world13(loader, THREAD);
+  real_jzfile* zip = (real_jzfile*) _zip;
+  tty->print_cr("CompileTheWorld : Compiling all classes in %s", zip->name);
+  tty->cr();
+  // Iterate over all entries in zip file
+  for (int n = 0; ; n++) {
+    real_jzentry * ze = (real_jzentry *)((*GetNextEntry)(_zip, n));
+    if (ze == NULL) break;
+    ClassLoader::compile_the_world_in(ze->name, loader, CHECK);
   }
   if (HAS_PENDING_EXCEPTION) {
     if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
@@ -1213,54 +1189,8 @@
   }
 }
 
-// Version that works for JDK 1.3.x
-void ClassPathZipEntry::compile_the_world13(Handle loader, TRAPS) {
-  real_jzfile13* zip = (real_jzfile13*) _zip;
-  tty->print_cr("CompileTheWorld : Compiling all classes in %s", zip->name);
-  tty->cr();
-  // Iterate over all entries in zip file
-  for (int n = 0; ; n++) {
-    real_jzentry13 * ze = (real_jzentry13 *)((*GetNextEntry)(_zip, n));
-    if (ze == NULL) break;
-    ClassLoader::compile_the_world_in(ze->name, loader, CHECK);
-  }
-}
-
-
-// Version that works for JDK 1.2.x
-void ClassPathZipEntry::compile_the_world12(Handle loader, TRAPS) {
-  real_jzfile12* zip = (real_jzfile12*) _zip;
-  tty->print_cr("CompileTheWorld : Compiling all classes in %s", zip->name);
-  tty->cr();
-  // Iterate over all entries in zip file
-  for (int n = 0; ; n++) {
-    real_jzentry12 * ze = (real_jzentry12 *)((*GetNextEntry)(_zip, n));
-    if (ze == NULL) break;
-    ClassLoader::compile_the_world_in(ze->name, loader, CHECK);
-  }
-}
-
 bool ClassPathZipEntry::is_rt_jar() {
-  if (JDK_Version::is_jdk12x_version()) {
-    return is_rt_jar12();
-  } else {
-    return is_rt_jar13();
-  }
-}
-
-// JDK 1.3 version
-bool ClassPathZipEntry::is_rt_jar13() {
-  real_jzfile13* zip = (real_jzfile13*) _zip;
-  int len = (int)strlen(zip->name);
-  // Check whether zip name ends in "rt.jar"
-  // This will match other archives named rt.jar as well, but this is
-  // only used for debugging.
-  return (len >= 6) && (strcasecmp(zip->name + len - 6, "rt.jar") == 0);
-}
-
-// JDK 1.2 version
-bool ClassPathZipEntry::is_rt_jar12() {
-  real_jzfile12* zip = (real_jzfile12*) _zip;
+  real_jzfile* zip = (real_jzfile*) _zip;
   int len = (int)strlen(zip->name);
   // Check whether zip name ends in "rt.jar"
   // This will match other archives named rt.jar as well, but this is
--- a/hotspot/src/share/vm/classfile/classLoader.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -111,11 +111,7 @@
   void contents_do(void f(const char* name, void* context), void* context);
   // Debugging
   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
-  NOT_PRODUCT(void compile_the_world12(Handle loader, TRAPS);) // JDK 1.2 version
-  NOT_PRODUCT(void compile_the_world13(Handle loader, TRAPS);) // JDK 1.3 version
   NOT_PRODUCT(bool is_rt_jar();)
-  NOT_PRODUCT(bool is_rt_jar12();)
-  NOT_PRODUCT(bool is_rt_jar13();)
 };
 
 
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -624,6 +624,12 @@
   }
 }
 
+void ClassLoaderDataGraph::cld_do(CLDClosure* cl) {
+  for (ClassLoaderData* cld = _head; cl != NULL && cld != NULL; cld = cld->next()) {
+    cl->do_cld(cld);
+  }
+}
+
 void ClassLoaderDataGraph::classes_do(KlassClosure* klass_closure) {
   for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
     cld->classes_do(klass_closure);
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -77,6 +77,7 @@
   static void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim);
   static void always_strong_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim);
   static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim);
+  static void cld_do(CLDClosure* cl);
   static void classes_do(KlassClosure* klass_closure);
   static void classes_do(void f(Klass* const));
   static void methods_do(void f(Method*));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/classLoaderStats.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -0,0 +1,167 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/classLoaderStats.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+
+class ClassStatsClosure : public KlassClosure {
+public:
+  int _num_classes;
+
+  ClassStatsClosure() :
+    _num_classes(0) {
+  }
+
+  virtual void do_klass(Klass* k) {
+    _num_classes++;
+  }
+};
+
+
+void ClassLoaderStatsClosure::do_cld(ClassLoaderData* cld) {
+  oop cl = cld->class_loader();
+  ClassLoaderStats* cls;
+
+  // The hashtable key is the ClassLoader oop since we want to account
+  // for "real" classes and anonymous classes together
+  ClassLoaderStats** cls_ptr = _stats->get(cl);
+  if (cls_ptr == NULL) {
+    cls = new ClassLoaderStats();
+    _stats->put(cl, cls);
+    _total_loaders++;
+  } else {
+    cls = *cls_ptr;
+  }
+
+  if (!cld->is_anonymous()) {
+    cls->_cld = cld;
+  }
+
+  cls->_class_loader = cl;
+  if (cl != NULL) {
+    cls->_parent = java_lang_ClassLoader::parent(cl);
+    addEmptyParents(cls->_parent);
+  }
+
+  ClassStatsClosure csc;
+  cld->classes_do(&csc);
+  if(cld->is_anonymous()) {
+    cls->_anon_classes_count += csc._num_classes;
+  } else {
+    cls->_classes_count = csc._num_classes;
+  }
+  _total_classes += csc._num_classes;
+
+  Metaspace* ms = cld->metaspace_or_null();
+  if (ms != NULL) {
+    if(cld->is_anonymous()) {
+      cls->_anon_chunk_sz += ms->allocated_chunks_bytes();
+      cls->_anon_block_sz += ms->allocated_blocks_bytes();
+    } else {
+      cls->_chunk_sz = ms->allocated_chunks_bytes();
+      cls->_block_sz = ms->allocated_blocks_bytes();
+    }
+    _total_chunk_sz += ms->allocated_chunks_bytes();
+    _total_block_sz += ms->allocated_blocks_bytes();
+  }
+}
+
+
+// Handles the difference in pointer width on 32 and 64 bit platforms
+#ifdef _LP64
+  #define SPACE "%8s"
+#else
+  #define SPACE "%s"
+#endif
+
+
+bool ClassLoaderStatsClosure::do_entry(oop const& key, ClassLoaderStats* const& cls) {
+  Klass* class_loader_klass = (cls->_class_loader == NULL ? NULL : cls->_class_loader->klass());
+  Klass* parent_klass = (cls->_parent == NULL ? NULL : cls->_parent->klass());
+
+  _out->print(INTPTR_FORMAT "  " INTPTR_FORMAT "  " INTPTR_FORMAT "  " UINTX_FORMAT_W(6) "  " SIZE_FORMAT_W(8) "  " SIZE_FORMAT_W(8) "  ",
+      p2i(class_loader_klass), p2i(parent_klass), p2i(cls->_cld),
+      cls->_classes_count,
+      cls->_chunk_sz, cls->_block_sz);
+  if (class_loader_klass != NULL) {
+    _out->print("%s", class_loader_klass->external_name());
+  } else {
+    _out->print("<boot class loader>");
+  }
+  _out->cr();
+  if (cls->_anon_classes_count > 0) {
+    _out->print_cr(SPACE SPACE SPACE "                                    " UINTX_FORMAT_W(6) "  " SIZE_FORMAT_W(8) "  " SIZE_FORMAT_W(8) "   + unsafe anonymous classes",
+        "", "", "",
+        cls->_anon_classes_count,
+        cls->_anon_chunk_sz, cls->_anon_block_sz);
+  }
+  return true;
+}
+
+
+void ClassLoaderStatsClosure::print() {
+  _out->print_cr("ClassLoader" SPACE " Parent" SPACE "      CLD*" SPACE "       Classes   ChunkSz   BlockSz  Type", "", "", "");
+  _stats->iterate(this);
+  _out->print("Total = " UINTX_FORMAT_W(-6), _total_loaders);
+  _out->print(SPACE SPACE SPACE "                      ", "", "", "");
+  _out->print_cr(UINTX_FORMAT_W(6) "  " SIZE_FORMAT_W(8) "  " SIZE_FORMAT_W(8) "  ",
+      _total_classes,
+      _total_chunk_sz,
+      _total_block_sz);
+  _out->print_cr("ChunkSz: Total size of all allocated metaspace chunks");
+  _out->print_cr("BlockSz: Total size of all allocated metaspace blocks (each chunk has several blocks)");
+}
+
+
+void ClassLoaderStatsClosure::addEmptyParents(oop cl) {
+  while (cl != NULL && java_lang_ClassLoader::loader_data(cl) == NULL) {
+    // This classloader has not loaded any classes
+    ClassLoaderStats** cls_ptr = _stats->get(cl);
+    if (cls_ptr == NULL) {
+      // It does not exist in our table - add it
+      ClassLoaderStats* cls = new ClassLoaderStats();
+      cls->_class_loader = cl;
+      cls->_parent = java_lang_ClassLoader::parent(cl);
+      _stats->put(cl, cls);
+      _total_loaders++;
+    }
+
+    cl = java_lang_ClassLoader::parent(cl);
+  }
+}
+
+
+void ClassLoaderStatsVMOperation::doit() {
+  ClassLoaderStatsClosure clsc (_out);
+  ClassLoaderDataGraph::cld_do(&clsc);
+  clsc.print();
+}
+
+
+void ClassLoaderStatsDCmd::execute(DCmdSource source, TRAPS) {
+  ClassLoaderStatsVMOperation op(output());
+  VMThread::execute(&op);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/classLoaderStats.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -0,0 +1,152 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_VM_CLASSFILE_CLASSLOADERSTATS_HPP
+#define SHARE_VM_CLASSFILE_CLASSLOADERSTATS_HPP
+
+
+#include "classfile/classLoaderData.hpp"
+#include "oops/klass.hpp"
+#include "oops/oopsHierarchy.hpp"
+#include "runtime/vm_operations.hpp"
+#include "services/diagnosticCommand.hpp"
+#include "utilities/resourceHash.hpp"
+
+
+class ClassLoaderStatsDCmd : public DCmd {
+public:
+  ClassLoaderStatsDCmd(outputStream* output, bool heap) :
+    DCmd(output, heap) {
+  }
+
+  static const char* name() {
+    return "VM.classloader_stats";
+  }
+
+  static const char* description() {
+    return "Print statistics about all ClassLoaders.";
+  }
+
+  static const char* impact() {
+    return "Low";
+  }
+
+  virtual void execute(DCmdSource source, TRAPS);
+
+  static int num_arguments() {
+    return 0;
+  }
+
+  static const JavaPermission permission() {
+    JavaPermission p = {"java.lang.management.ManagementPermission",
+                        "monitor", NULL};
+    return p;
+  }
+};
+
+
+class ClassLoaderStats : public ResourceObj {
+public:
+  ClassLoaderData*  _cld;
+  oop               _class_loader;
+  oop               _parent;
+
+  size_t            _chunk_sz;
+  size_t            _block_sz;
+  uintx             _classes_count;
+
+  size_t            _anon_chunk_sz;
+  size_t            _anon_block_sz;
+  uintx             _anon_classes_count;
+
+  ClassLoaderStats() :
+    _cld(0),
+    _class_loader(0),
+    _parent(0),
+    _chunk_sz(0),
+    _block_sz(0),
+    _classes_count(0),
+    _anon_block_sz(0),
+    _anon_chunk_sz(0),
+    _anon_classes_count(0) {
+  }
+};
+
+
+class ClassLoaderStatsClosure : public CLDClosure {
+protected:
+  static bool oop_equals(oop const& s1, oop const& s2) {
+    return s1 == s2;
+  }
+
+  static unsigned oop_hash(oop const& s1) {
+    unsigned hash = (unsigned)((uintptr_t)&s1);
+    return hash ^ (hash >> LogMinObjAlignment);
+  }
+
+  typedef ResourceHashtable<oop, ClassLoaderStats*,
+      ClassLoaderStatsClosure::oop_hash, ClassLoaderStatsClosure::oop_equals> StatsTable;
+
+  outputStream* _out;
+  StatsTable* _stats;
+  uintx   _total_loaders;
+  uintx   _total_classes;
+  size_t  _total_chunk_sz;
+  size_t  _total_block_sz;
+
+public:
+  ClassLoaderStatsClosure(outputStream* out) :
+    _out(out),
+    _total_loaders(0),
+    _total_block_sz(0),
+    _total_chunk_sz(0),
+    _total_classes(0),
+    _stats(new StatsTable()) {
+  }
+
+  virtual void do_cld(ClassLoaderData* cld);
+  virtual bool do_entry(oop const& key, ClassLoaderStats* const& cls);
+  void print();
+
+private:
+  void addEmptyParents(oop cl);
+};
+
+
+class ClassLoaderStatsVMOperation : public VM_Operation {
+  outputStream* _out;
+
+public:
+  ClassLoaderStatsVMOperation(outputStream* out) :
+    _out(out) {
+  }
+
+  VMOp_Type type() const {
+    return VMOp_ClassLoaderStatsOperation;
+  }
+
+  void doit();
+};
+
+#endif // SHARE_VM_CLASSFILE_CLASSLOADERSTATS_HPP
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -857,9 +857,7 @@
 }
 
 int java_lang_Class::classRedefinedCount(oop the_class_mirror) {
-  if (!JDK_Version::is_gte_jdk15x_version()
-      || classRedefinedCount_offset == -1) {
-    // The classRedefinedCount field is only present starting in 1.5.
+  if (classRedefinedCount_offset == -1) {
     // If we don't have an offset for it then just return -1 as a marker.
     return -1;
   }
@@ -868,9 +866,7 @@
 }
 
 void java_lang_Class::set_classRedefinedCount(oop the_class_mirror, int value) {
-  if (!JDK_Version::is_gte_jdk15x_version()
-      || classRedefinedCount_offset == -1) {
-    // The classRedefinedCount field is only present starting in 1.5.
+  if (classRedefinedCount_offset == -1) {
     // If we don't have an offset for it then nothing to set.
     return;
   }
@@ -1000,9 +996,7 @@
 
 
 jlong java_lang_Thread::stackSize(oop java_thread) {
-  // The stackSize field is only present starting in 1.4
   if (_stackSize_offset > 0) {
-    assert(JDK_Version::is_gte_jdk14x_version(), "sanity check");
     return java_thread->long_field(_stackSize_offset);
   } else {
     return 0;
@@ -1078,7 +1072,7 @@
 
 
 const char* java_lang_Thread::thread_status_name(oop java_thread) {
-  assert(JDK_Version::is_gte_jdk15x_version() && _thread_status_offset != 0, "Must have thread status");
+  assert(_thread_status_offset != 0, "Must have thread status");
   ThreadStatus status = (java_lang_Thread::ThreadStatus)java_thread->int_field(_thread_status_offset);
   switch (status) {
     case NEW                      : return "NEW";
@@ -1217,7 +1211,6 @@
 }
 
 void java_lang_Throwable::clear_stacktrace(oop throwable) {
-  assert(JDK_Version::is_gte_jdk14x_version(), "should only be called in >= 1.4");
   set_stacktrace(throwable, NULL);
 }
 
@@ -1548,12 +1541,9 @@
   // Start out by clearing the backtrace for this object, in case the VM
   // runs out of memory while allocating the stack trace
   set_backtrace(throwable(), NULL);
-  if (JDK_Version::is_gte_jdk14x_version()) {
-    // New since 1.4, clear lazily constructed Java level stacktrace if
-    // refilling occurs
-    // This is unnecessary in 1.7+ but harmless
-    clear_stacktrace(throwable());
-  }
+  // Clear lazily constructed Java level stacktrace if refilling occurs
+  // This is unnecessary in 1.7+ but harmless
+  clear_stacktrace(throwable());
 
   int max_depth = MaxJavaStackTraceDepth;
   JavaThread* thread = (JavaThread*)THREAD;
@@ -1739,13 +1729,9 @@
     if (chunk_count >= max_chunks) break;
   }
 
-  // For Java 7+ we support the Throwable immutability protocol defined for Java 7. This support
-  // was missing in 7u0 so in 7u0 there is a workaround in the Throwable class. That workaround
-  // can be removed in a JDK using this JVM version
-  if (JDK_Version::is_gte_jdk17x_version()) {
-      java_lang_Throwable::set_stacktrace(throwable(), java_lang_Throwable::unassigned_stacktrace());
-      assert(java_lang_Throwable::unassigned_stacktrace() != NULL, "not initialized");
-  }
+  // We support the Throwable immutability protocol defined for Java 7.
+  java_lang_Throwable::set_stacktrace(throwable(), java_lang_Throwable::unassigned_stacktrace());
+  assert(java_lang_Throwable::unassigned_stacktrace() != NULL, "not initialized");
 }
 
 
@@ -3022,8 +3008,7 @@
 // based on non-null field
 // Written to by java.lang.ClassLoader, vm only reads this field, doesn't set it
 bool java_lang_ClassLoader::parallelCapable(oop class_loader) {
-  if (!JDK_Version::is_gte_jdk17x_version()
-     || parallelCapable_offset == -1) {
+  if (parallelCapable_offset == -1) {
      // Default for backward compatibility is false
      return false;
   }
@@ -3219,7 +3204,6 @@
 void java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(TRAPS) {
   if (_owner_offset != 0) return;
 
-  assert(JDK_Version::is_gte_jdk16x_version(), "Must be JDK 1.6 or later");
   SystemDictionary::load_abstract_ownable_synchronizer_klass(CHECK);
   Klass* k = SystemDictionary::abstract_ownable_synchronizer_klass();
   compute_offset(_owner_offset, k,
@@ -3309,15 +3293,10 @@
   java_lang_reflect_Method::compute_offsets();
   java_lang_reflect_Constructor::compute_offsets();
   java_lang_reflect_Field::compute_offsets();
-  if (JDK_Version::is_gte_jdk14x_version()) {
-    java_nio_Buffer::compute_offsets();
-  }
-  if (JDK_Version::is_gte_jdk15x_version()) {
-    sun_reflect_ConstantPool::compute_offsets();
-    sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
-  }
-  if (JDK_Version::is_gte_jdk18x_version())
-    java_lang_reflect_Parameter::compute_offsets();
+  java_nio_Buffer::compute_offsets();
+  sun_reflect_ConstantPool::compute_offsets();
+  sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
+  java_lang_reflect_Parameter::compute_offsets();
 
   // generated interpreter code wants to know about the offsets we just computed:
   AbstractAssembler::update_delayed_values();
@@ -3502,7 +3481,7 @@
   // into merlin "for some time."  Without it, the vm will fail with early
   // merlin builds.
 
-  if (CheckAssertionStatusDirectives && JDK_Version::is_gte_jdk14x_version()) {
+  if (CheckAssertionStatusDirectives) {
     const char* nm = "java/lang/AssertionStatusDirectives";
     const char* sig = "[Ljava/lang/String;";
     CHECK_OFFSET(nm, java_lang_AssertionStatusDirectives, classes, sig);
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -997,7 +997,6 @@
 
 
   if (host_klass.not_null() && k.not_null()) {
-    k->set_host_klass(host_klass());
     // If it's anonymous, initialize it now, since nobody else will.
 
     {
@@ -1754,8 +1753,6 @@
 // Lazily load klasses
 
 void SystemDictionary::load_abstract_ownable_synchronizer_klass(TRAPS) {
-  assert(JDK_Version::is_gte_jdk16x_version(), "Must be JDK 1.6 or later");
-
   // if multiple threads calling this function, only one thread will load
   // the class.  The other threads will find the loaded version once the
   // class is loaded.
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -139,14 +139,13 @@
   do_klass(reflect_Constructor_klass,                   java_lang_reflect_Constructor,             Pre                 ) \
                                                                                                                          \
   /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */                              \
-  /* Universe::is_gte_jdk14x_version() is not set up by this point. */                                                   \
   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
   do_klass(reflect_MagicAccessorImpl_klass,             sun_reflect_MagicAccessorImpl,             Opt                 ) \
-  do_klass(reflect_MethodAccessorImpl_klass,            sun_reflect_MethodAccessorImpl,            Opt_Only_JDK14NewRef) \
-  do_klass(reflect_ConstructorAccessorImpl_klass,       sun_reflect_ConstructorAccessorImpl,       Opt_Only_JDK14NewRef) \
+  do_klass(reflect_MethodAccessorImpl_klass,            sun_reflect_MethodAccessorImpl,            Pre                 ) \
+  do_klass(reflect_ConstructorAccessorImpl_klass,       sun_reflect_ConstructorAccessorImpl,       Pre                 ) \
   do_klass(reflect_DelegatingClassLoader_klass,         sun_reflect_DelegatingClassLoader,         Opt                 ) \
-  do_klass(reflect_ConstantPool_klass,                  sun_reflect_ConstantPool,                  Opt_Only_JDK15      ) \
-  do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, sun_reflect_UnsafeStaticFieldAccessorImpl, Opt_Only_JDK15      ) \
+  do_klass(reflect_ConstantPool_klass,                  sun_reflect_ConstantPool,                  Opt                 ) \
+  do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, sun_reflect_UnsafeStaticFieldAccessorImpl, Opt                 ) \
   do_klass(reflect_CallerSensitive_klass,               sun_reflect_CallerSensitive,               Opt                 ) \
                                                                                                                          \
   /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */                                            \
@@ -169,7 +168,6 @@
                                                                                                                          \
   /* It's NULL in non-1.4 JDKs. */                                                                                       \
   do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement,               Opt                 ) \
-  /* Universe::is_gte_jdk14x_version() is not set up by this point. */                                                   \
   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
   do_klass(nio_Buffer_klass,                            java_nio_Buffer,                           Opt                 ) \
                                                                                                                          \
@@ -209,10 +207,8 @@
     // Options after this point will use resolve_or_null instead.
 
     Opt,                        // preload tried; NULL if not present
-    Opt_Only_JDK14NewRef,       // preload tried; use only with NewReflection
-    Opt_Only_JDK15,             // preload tried; use only with JDK1.5+
     OPTION_LIMIT,
-    CEIL_LG_OPTION_LIMIT = 4    // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)
+    CEIL_LG_OPTION_LIMIT = 2    // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)
   };
 
 
@@ -385,15 +381,6 @@
 
   static Klass* check_klass_Pre(       Klass* k) { return check_klass(k); }
   static Klass* check_klass_Opt(       Klass* k) { return k; }
-  static Klass* check_klass_Opt_Only_JDK15(Klass* k) {
-    assert(JDK_Version::is_gte_jdk15x_version(), "JDK 1.5 only");
-    return k;
-  }
-  static Klass* check_klass_Opt_Only_JDK14NewRef(Klass* k) {
-    assert(JDK_Version::is_gte_jdk14x_version(), "JDK 1.4 only");
-    // despite the optional loading, if you use this it must be present:
-    return check_klass(k);
-  }
 
   static bool initialize_wk_klass(WKID id, int init_opt, TRAPS);
   static void initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -320,7 +320,6 @@
   template(reference_discovered_name,                 "discovered")                               \
   template(run_finalization_name,                     "runFinalization")                          \
   template(run_finalizers_on_exit_name,               "runFinalizersOnExit")                      \
-  template(uncaughtException_name,                    "uncaughtException")                        \
   template(dispatchUncaughtException_name,            "dispatchUncaughtException")                \
   template(initializeSystemClass_name,                "initializeSystemClass")                    \
   template(loadClass_name,                            "loadClass")                                \
--- a/hotspot/src/share/vm/compiler/methodLiveness.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -475,7 +475,7 @@
     bci = 0;
   }
 
-  MethodLivenessResult answer((uintptr_t*)NULL,0);
+  MethodLivenessResult answer((BitMap::bm_word_t*)NULL,0);
 
   if (_block_count > 0) {
     if (TimeLivenessAnalysis) _time_total.start();
@@ -1000,7 +1000,7 @@
 }
 
 MethodLivenessResult MethodLiveness::BasicBlock::get_liveness_at(ciMethod* method, int bci) {
-  MethodLivenessResult answer(NEW_RESOURCE_ARRAY(uintptr_t, _analyzer->bit_map_size_words()),
+  MethodLivenessResult answer(NEW_RESOURCE_ARRAY(BitMap::bm_word_t, _analyzer->bit_map_size_words()),
                 _analyzer->bit_map_size_bits());
   answer.set_is_valid();
 
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -127,7 +127,7 @@
   }
   assert(_virtual_space.committed_size() == brs.size(),
          "didn't reserve backing store for all of concurrent marking bit map?");
-  _bm.set_map((uintptr_t*)_virtual_space.low());
+  _bm.set_map((BitMap::bm_word_t*)_virtual_space.low());
   assert(_virtual_space.committed_size() << (_shifter + LogBitsPerByte) >=
          _bmWordSize, "inconsistency in bit map sizing");
   _bm.set_size(_bmWordSize >> _shifter);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -433,14 +433,6 @@
   return hr;
 }
 
-void G1CollectedHeap::stop_conc_gc_threads() {
-  _cg1r->stop();
-  _cmThread->stop();
-  if (G1StringDedup::is_enabled()) {
-    G1StringDedup::stop();
-  }
-}
-
 #ifdef ASSERT
 // A region is added to the collection set as it is retired
 // so an address p can point to a region which will be in the
@@ -2174,20 +2166,14 @@
 }
 
 void G1CollectedHeap::stop() {
-#if 0
-  // Stopping concurrent worker threads is currently disabled until
-  // some bugs in concurrent mark has been resolve. Without fixing
-  // those bugs first we risk haning during VM exit when trying to
-  // stop these threads.
-
-  // Abort any ongoing concurrent root region scanning and stop all
-  // concurrent threads. We do this to make sure these threads do
-  // not continue to execute and access resources (e.g. gclog_or_tty)
+  // Stop all concurrent threads. We do this to make sure these threads
+  // do not continue to execute and access resources (e.g. gclog_or_tty)
   // that are destroyed during shutdown.
-  _cm->root_regions()->abort();
-  _cm->root_regions()->wait_until_scan_finished();
-  stop_conc_gc_threads();
-#endif
+  _cg1r->stop();
+  _cmThread->stop();
+  if (G1StringDedup::is_enabled()) {
+    G1StringDedup::stop();
+  }
 }
 
 size_t G1CollectedHeap::conservative_max_heap_alignment() {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -1684,8 +1684,6 @@
   void print_all_rsets() PRODUCT_RETURN;
 
 public:
-  void stop_conc_gc_threads();
-
   size_t pending_card_num();
   size_t cards_scanned();
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -71,7 +71,7 @@
   if (_virtual_space != NULL && _virtual_space->expand_by(_reserved_byte_size)) {
     _region_start = covered_region.start();
     _region_size = covered_region.word_size();
-    idx_t* map = (idx_t*)_virtual_space->reserved_low_addr();
+    BitMap::bm_word_t* map = (BitMap::bm_word_t*)_virtual_space->reserved_low_addr();
     _beg_bits.set_map(map);
     _beg_bits.set_size(bits / 2);
     _end_bits.set_map(map + words / 2);
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -945,12 +945,8 @@
     Klass *klass_to_check = !InstanceKlass::cast(current_klass())->is_anonymous() ?
                                   current_klass() :
                                   InstanceKlass::cast(current_klass())->host_klass();
-    // As of the fix for 4486457 we disable verification for all of the
-    // dynamically-generated bytecodes associated with the 1.4
-    // reflection implementation, not just those associated with
-    // sun/reflect/SerializationConstructorAccessor.
-    bool is_reflect = JDK_Version::is_gte_jdk14x_version() &&
-                      klass_to_check->is_subclass_of(
+    // Disable verification for the dynamically-generated reflection bytecodes.
+    bool is_reflect = klass_to_check->is_subclass_of(
                         SystemDictionary::reflect_MagicAccessorImpl_klass());
 
     if (!is_reflect &&
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/memory/guardedMemory.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -0,0 +1,161 @@
+/*
+ * 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.
+ *
+ */
+#include "precompiled.hpp"
+#include "memory/allocation.hpp"
+#include "memory/allocation.inline.hpp"
+#include "memory/guardedMemory.hpp"
+#include "runtime/os.hpp"
+
+void* GuardedMemory::wrap_copy(const void* ptr, const size_t len, const void* tag) {
+  size_t total_sz = GuardedMemory::get_total_size(len);
+  void* outerp = os::malloc(total_sz, mtInternal);
+  if (outerp != NULL) {
+    GuardedMemory guarded(outerp, len, tag);
+    void* innerp = guarded.get_user_ptr();
+    memcpy(innerp, ptr, len);
+    return innerp;
+  }
+  return NULL; // OOM
+}
+
+bool GuardedMemory::free_copy(void* p) {
+  if (p == NULL) {
+    return true;
+  }
+  GuardedMemory guarded((u_char*)p);
+  bool verify_ok = guarded.verify_guards();
+
+  /* always attempt to free, pass problem on to any nested memchecker */
+  os::free(guarded.release_for_freeing());
+
+  return verify_ok;
+}
+
+void GuardedMemory::print_on(outputStream* st) const {
+  if (_base_addr == NULL) {
+    st->print_cr("GuardedMemory(" PTR_FORMAT ") not associated to any memory", p2i(this));
+    return;
+  }
+  st->print_cr("GuardedMemory(" PTR_FORMAT ") base_addr=" PTR_FORMAT
+      " tag=" PTR_FORMAT " user_size=" SIZE_FORMAT " user_data=" PTR_FORMAT,
+      p2i(this), p2i(_base_addr), p2i(get_tag()), get_user_size(), p2i(get_user_ptr()));
+
+  Guard* guard = get_head_guard();
+  st->print_cr("  Header guard @" PTR_FORMAT " is %s", p2i(guard), (guard->verify() ? "OK" : "BROKEN"));
+  guard = get_tail_guard();
+  st->print_cr("  Trailer guard @" PTR_FORMAT " is %s", p2i(guard), (guard->verify() ? "OK" : "BROKEN"));
+
+  u_char udata = *get_user_ptr();
+  switch (udata) {
+  case uninitBlockPad:
+    st->print_cr("  User data appears unused");
+    break;
+  case freeBlockPad:
+    st->print_cr("  User data appears to have been freed");
+    break;
+  default:
+    st->print_cr("  User data appears to be in use");
+    break;
+  }
+}
+
+// test code...
+
+#ifndef PRODUCT
+
+static void guarded_memory_test_check(void* p, size_t sz, void* tag) {
+  assert(p != NULL, "NULL pointer given to check");
+  u_char* c = (u_char*) p;
+  GuardedMemory guarded(c);
+  assert(guarded.get_tag() == tag, "Tag is not the same as supplied");
+  assert(guarded.get_user_ptr() == c, "User pointer is not the same as supplied");
+  assert(guarded.get_user_size() == sz, "User size is not the same as supplied");
+  assert(guarded.verify_guards(), "Guard broken");
+}
+
+void GuardedMemory::test_guarded_memory() {
+  // Test the basic characteristics...
+  size_t total_sz = GuardedMemory::get_total_size(1);
+  assert(total_sz > 1 && total_sz >= (sizeof(GuardHeader) + 1 + sizeof(Guard)), "Unexpected size");
+  u_char* basep = (u_char*) os::malloc(total_sz, mtInternal);
+
+  GuardedMemory guarded(basep, 1, (void*)0xf000f000);
+
+  assert(*basep == badResourceValue, "Expected guard in the form of badResourceValue");
+  u_char* userp = guarded.get_user_ptr();
+  assert(*userp == uninitBlockPad, "Expected uninitialized data in the form of uninitBlockPad");
+  guarded_memory_test_check(userp, 1, (void*)0xf000f000);
+
+  void* freep = guarded.release_for_freeing();
+  assert((u_char*)freep == basep, "Expected the same pointer guard was ");
+  assert(*userp == freeBlockPad, "Expected user data to be free block padded");
+  assert(!guarded.verify_guards(), "Expected failed");
+  os::free(freep);
+
+  // Test a number of odd sizes...
+  size_t sz = 0;
+  do {
+    void* p = os::malloc(GuardedMemory::get_total_size(sz), mtInternal);
+    void* up = guarded.wrap_with_guards(p, sz, (void*)1);
+    memset(up, 0, sz);
+    guarded_memory_test_check(up, sz, (void*)1);
+    os::free(guarded.release_for_freeing());
+    sz = (sz << 4) + 1;
+  } while (sz < (256 * 1024));
+
+  // Test buffer overrun into head...
+  basep = (u_char*) os::malloc(GuardedMemory::get_total_size(1), mtInternal);
+  guarded.wrap_with_guards(basep, 1);
+  *basep = 0;
+  assert(!guarded.verify_guards(), "Expected failure");
+  os::free(basep);
+
+  // Test buffer overrun into tail with a number of odd sizes...
+  sz = 1;
+  do {
+    void* p = os::malloc(GuardedMemory::get_total_size(sz), mtInternal);
+    void* up = guarded.wrap_with_guards(p, sz, (void*)1);
+    memset(up, 0, sz + 1); // Buffer-overwrite (within guard)
+    assert(!guarded.verify_guards(), "Guard was not broken as expected");
+    os::free(guarded.release_for_freeing());
+    sz = (sz << 4) + 1;
+  } while (sz < (256 * 1024));
+
+  // Test wrap_copy/wrap_free...
+  assert(GuardedMemory::free_copy(NULL), "Expected free NULL to be OK");
+
+  const char* str = "Check my bounds out";
+  size_t str_sz = strlen(str) + 1;
+  char* str_copy = (char*) GuardedMemory::wrap_copy(str, str_sz);
+  guarded_memory_test_check(str_copy, str_sz, NULL);
+  assert(strcmp(str, str_copy) == 0, "Not identical copy");
+  assert(GuardedMemory::free_copy(str_copy), "Free copy failed to verify");
+
+  void* no_data = NULL;
+  void* no_data_copy = GuardedMemory::wrap_copy(no_data, 0);
+  assert(GuardedMemory::free_copy(no_data_copy), "Expected valid guards even for no data copy");
+}
+
+#endif // !PRODUCT
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/memory/guardedMemory.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -0,0 +1,326 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_VM_MEMORY_GUARDED_MEMORY_HPP
+#define SHARE_VM_MEMORY_GUARDED_MEMORY_HPP
+
+#include "memory/allocation.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+/**
+ * Guarded memory for detecting buffer overrun.
+ *
+ * Allows allocations to be wrapped with padded bytes of a known byte pattern,
+ * that is a "guard". Guard patterns may be verified to detect buffer overruns.
+ *
+ * Primarily used by "debug malloc" and "checked JNI".
+ *
+ * Memory layout:
+ *
+ * |Offset             | Content              | Description    |
+ * |------------------------------------------------------------
+ * |base_addr          | 0xABABABABABABABAB   | Head guard     |
+ * |+16                | <size_t:user_size>   | User data size |
+ * |+sizeof(uintptr_t) | <tag>                | Tag word       |
+ * |+sizeof(void*)     | 0xF1 <user_data> (   | User data      |
+ * |+user_size         | 0xABABABABABABABAB   | Tail guard     |
+ * -------------------------------------------------------------
+ *
+ * Where:
+ *  - guard padding uses "badResourceValue" (0xAB)
+ *  - tag word is general purpose
+ *  - user data
+ *    -- initially padded with "uninitBlockPad" (0xF1),
+ *    -- to "freeBlockPad" (0xBA), when freed
+ *
+ * Usage:
+ *
+ * * Allocations: one may wrap allocations with guard memory:
+ * <code>
+ *   Thing* alloc_thing() {
+ *     void* mem = user_alloc_fn(GuardedMemory::get_total_size(sizeof(thing)));
+ *     GuardedMemory guarded(mem, sizeof(thing));
+ *     return (Thing*) guarded.get_user_ptr();
+ *   }
+ * </code>
+ * * Verify: memory guards are still in tact
+ * <code>
+ *   bool verify_thing(Thing* thing) {
+ *     GuardedMemory guarded((void*)thing);
+ *     return guarded.verify_guards();
+ *   }
+ * </code>
+ * * Free: one may mark bytes as freed (further debugging support)
+ * <code>
+ *   void free_thing(Thing* thing) {
+ *    GuardedMemory guarded((void*)thing);
+ *    assert(guarded.verify_guards(), "Corrupt thing");
+ *    user_free_fn(guards.release_for_freeing();
+ *   }
+ * </code>
+ */
+class GuardedMemory : StackObj { // Wrapper on stack
+
+  // Private inner classes for memory layout...
+
+protected:
+
+  /**
+   * Guard class for header and trailer known pattern to test for overwrites.
+   */
+  class Guard { // Class for raw memory (no vtbl allowed)
+    friend class GuardedMemory;
+   protected:
+    enum {
+      GUARD_SIZE = 16
+    };
+
+    u_char _guard[GUARD_SIZE];
+
+   public:
+
+    void build() {
+      u_char* c = _guard; // Possibly unaligned if tail guard
+      u_char* end = c + GUARD_SIZE;
+      while (c < end) {
+        *c = badResourceValue;
+        c++;
+      }
+    }
+
+    bool verify() const {
+      u_char* c = (u_char*) _guard;
+      u_char* end = c + GUARD_SIZE;
+      while (c < end) {
+        if (*c != badResourceValue) {
+          return false;
+        }
+        c++;
+      }
+      return true;
+    }
+
+  }; // GuardedMemory::Guard
+
+  /**
+   * Header guard and size
+   */
+  class GuardHeader : Guard {
+    friend class GuardedMemory;
+   protected:
+    // Take care in modifying fields here, will effect alignment
+    // e.g. x86 ABI 16 byte stack alignment
+    union {
+      uintptr_t __unused_full_word1;
+      size_t _user_size;
+    };
+    void* _tag;
+   public:
+    void set_user_size(const size_t usz) { _user_size = usz; }
+    size_t get_user_size() const { return _user_size; }
+
+    void set_tag(const void* tag) { _tag = (void*) tag; }
+    void* get_tag() const { return _tag; }
+
+  }; // GuardedMemory::GuardHeader
+
+  // Guarded Memory...
+
+ protected:
+  u_char* _base_addr;
+
+ public:
+
+  /**
+   * Create new guarded memory.
+   *
+   * Wraps, starting at the given "base_ptr" with guards. Use "get_user_ptr()"
+   * to return a pointer suitable for user data.
+   *
+   * @param base_ptr  allocation wishing to be wrapped, must be at least "GuardedMemory::get_total_size()" bytes.
+   * @param user_size the size of the user data to be wrapped.
+   * @param tag       optional general purpose tag.
+   */
+  GuardedMemory(void* base_ptr, const size_t user_size, const void* tag = NULL) {
+    wrap_with_guards(base_ptr, user_size, tag);
+  }
+
+  /**
+   * Wrap existing guarded memory.
+   *
+   * To use this constructor, one must have created guarded memory with
+   * "GuardedMemory(void*, size_t, void*)" (or indirectly via helper, e.g. "wrap_copy()").
+   *
+   * @param user_p  existing wrapped memory.
+   */
+  GuardedMemory(void* userp) {
+    u_char* user_ptr = (u_char*) userp;
+    assert((uintptr_t)user_ptr > (sizeof(GuardHeader) + 0x1000), "Invalid pointer");
+    _base_addr = (user_ptr - sizeof(GuardHeader));
+  }
+
+  /**
+   * Create new guarded memory.
+   *
+   * Wraps, starting at the given "base_ptr" with guards. Allows reuse of stack allocated helper.
+   *
+   * @param base_ptr  allocation wishing to be wrapped, must be at least "GuardedMemory::get_total_size()" bytes.
+   * @param user_size the size of the user data to be wrapped.
+   * @param tag       optional general purpose tag.
+   *
+   * @return user data pointer (inner pointer to supplied "base_ptr").
+   */
+  void* wrap_with_guards(void* base_ptr, size_t user_size, const void* tag = NULL) {
+    assert(base_ptr != NULL, "Attempt to wrap NULL with memory guard");
+    _base_addr = (u_char*)base_ptr;
+    get_head_guard()->build();
+    get_head_guard()->set_user_size(user_size);
+    get_tail_guard()->build();
+    set_tag(tag);
+    set_user_bytes(uninitBlockPad);
+    assert(verify_guards(), "Expected valid memory guards");
+    return get_user_ptr();
+  }
+
+  /**
+   * Verify head and tail guards.
+   *
+   * @return true if guards are intact, false would indicate a buffer overrun.
+   */
+  bool verify_guards() const {
+    if (_base_addr != NULL) {
+      return (get_head_guard()->verify() && get_tail_guard()->verify());
+    }
+    return false;
+  }
+
+  /**
+   * Set the general purpose tag.
+   *
+   * @param tag general purpose tag.
+   */
+  void set_tag(const void* tag) { get_head_guard()->set_tag(tag); }
+
+  /**
+   * Return the general purpose tag.
+   *
+   * @return the general purpose tag, defaults to NULL.
+   */
+  void* get_tag() const { return get_head_guard()->get_tag(); }
+
+  /**
+   * Return the size of the user data.
+   *
+   * @return the size of the user data.
+   */
+  size_t get_user_size() const {
+    assert(_base_addr != NULL, "Not wrapping any memory");
+    return get_head_guard()->get_user_size();
+  }
+
+  /**
+   * Return the user data pointer.
+   *
+   * @return the user data pointer.
+   */
+  u_char* get_user_ptr() const {
+    assert(_base_addr != NULL, "Not wrapping any memory");
+    return _base_addr + sizeof(GuardHeader);
+  }
+
+  /**
+   * Release the wrapped pointer for resource freeing.
+   *
+   * Pads the user data with "freeBlockPad", and dis-associates the helper.
+   *
+   * @return the original base pointer used to wrap the data.
+   */
+  void* release_for_freeing() {
+    set_user_bytes(freeBlockPad);
+    return release();
+  }
+
+  /**
+   * Dis-associate the help from the original base address.
+   *
+   * @return the original base pointer used to wrap the data.
+   */
+  void* release() {
+    void* p = (void*) _base_addr;
+    _base_addr = NULL;
+    return p;
+  }
+
+  virtual void print_on(outputStream* st) const;
+
+ protected:
+  GuardHeader*  get_head_guard() const { return (GuardHeader*) _base_addr; }
+  Guard*        get_tail_guard() const { return (Guard*) (get_user_ptr() + get_user_size()); };
+  void set_user_bytes(u_char ch) {
+    memset(get_user_ptr(), ch, get_user_size());
+  }
+
+ public:
+  /**
+   * Return the total size required for wrapping the given user size.
+   *
+   * @return the total size required for wrapping the given user size.
+   */
+  static size_t get_total_size(size_t user_size) {
+    size_t total_size = sizeof(GuardHeader) + user_size + sizeof(Guard);
+    assert(total_size > user_size, "Unexpected wrap-around");
+    return total_size;
+  }
+
+  // Helper functions...
+
+  /**
+   * Wrap a copy of size "len" of "ptr".
+   *
+   * @param ptr the memory to be copied
+   * @param len the length of the copy
+   * @param tag optional general purpose tag (see GuardedMemory::get_tag())
+   *
+   * @return guarded wrapped memory pointer to the user area, or NULL if OOM.
+   */
+  static void* wrap_copy(const void* p, const size_t len, const void* tag = NULL);
+
+  /**
+   * Free wrapped copy.
+   *
+   * Frees memory copied with "wrap_copy()".
+   *
+   * @param p memory returned by "wrap_copy()".
+   *
+   * @return true if guards were verified as intact. false indicates a buffer overrun.
+   */
+  static bool free_copy(void* p);
+
+  // Testing...
+#ifndef PRODUCT
+  static void test_guarded_memory(void);
+#endif
+}; // GuardedMemory
+
+#endif // SHARE_VM_MEMORY_GUARDED_MEMORY_HPP
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -697,6 +697,7 @@
   size_t allocated_blocks_words() const { return _allocated_blocks_words; }
   size_t allocated_blocks_bytes() const { return _allocated_blocks_words * BytesPerWord; }
   size_t allocated_chunks_words() const { return _allocated_chunks_words; }
+  size_t allocated_chunks_bytes() const { return _allocated_chunks_words * BytesPerWord; }
   size_t allocated_chunks_count() const { return _allocated_chunks_count; }
 
   bool is_humongous(size_t word_size) { return word_size > medium_chunk_size(); }
@@ -3365,6 +3366,16 @@
   return capacity_words_slow(mdtype) * BytesPerWord;
 }
 
+size_t Metaspace::allocated_blocks_bytes() const {
+  return vsm()->allocated_blocks_bytes() +
+      (using_class_space() ? class_vsm()->allocated_blocks_bytes() : 0);
+}
+
+size_t Metaspace::allocated_chunks_bytes() const {
+  return vsm()->allocated_chunks_bytes() +
+      (using_class_space() ? class_vsm()->allocated_chunks_bytes() : 0);
+}
+
 void Metaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_class) {
   assert(!SafepointSynchronize::is_at_safepoint()
          || Thread::current()->is_VM_thread(), "should be the VM thread");
--- a/hotspot/src/share/vm/memory/metaspace.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/memory/metaspace.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -226,6 +226,9 @@
   size_t used_bytes_slow(MetadataType mdtype) const;
   size_t capacity_bytes_slow(MetadataType mdtype) const;
 
+  size_t allocated_blocks_bytes() const;
+  size_t allocated_chunks_bytes() const;
+
   static MetaWord* allocate(ClassLoaderData* loader_data, size_t word_size,
                             bool read_only, MetaspaceObj::Type type, TRAPS);
   void deallocate(MetaWord* ptr, size_t byte_size, bool is_class);
--- a/hotspot/src/share/vm/memory/universe.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/memory/universe.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -1000,9 +1000,6 @@
 }
 
 
-// This function is defined in JVM.cpp
-extern void initialize_converter_functions();
-
 bool universe_post_init() {
   assert(!is_init_completed(), "Error: initialization not yet completed!");
   Universe::_fully_initialized = true;
@@ -1144,11 +1141,6 @@
       SystemDictionary::ProtectionDomain_klass(), m);;
   }
 
-  // The following is initializing converter functions for serialization in
-  // JVM.cpp. If we clean up the StrictMath code above we may want to find
-  // a better solution for this as well.
-  initialize_converter_functions();
-
   // This needs to be done before the first scavenge/gc, since
   // it's an input to soft ref clearing policy.
   {
--- a/hotspot/src/share/vm/oops/method.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/oops/method.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -1023,8 +1023,7 @@
     // This is Method.invoke() -- ignore it
     return true;
   }
-  if (JDK_Version::is_gte_jdk14x_version() &&
-      method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
+  if (method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
     // This is an auxilary frame -- ignore it
     return true;
   }
--- a/hotspot/src/share/vm/prims/jni.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/prims/jni.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -3858,6 +3858,7 @@
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/heapRegionRemSet.hpp"
 #endif
+#include "memory/guardedMemory.hpp"
 #include "utilities/quickSort.hpp"
 #include "utilities/ostream.hpp"
 #if INCLUDE_VM_STRUCTS
@@ -3901,6 +3902,7 @@
     run_unit_test(arrayOopDesc::test_max_array_length());
     run_unit_test(CollectedHeap::test_is_in());
     run_unit_test(QuickSort::test_quick_sort());
+    run_unit_test(GuardedMemory::test_guarded_memory());
     run_unit_test(AltHashing::test_alt_hash());
     run_unit_test(test_loggc_filename());
     run_unit_test(TestNewSize_test());
--- a/hotspot/src/share/vm/prims/jniCheck.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "memory/guardedMemory.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/symbol.hpp"
@@ -52,6 +53,8 @@
 # include "jniTypes_ppc.hpp"
 #endif
 
+// Complain every extra number of unplanned local refs
+#define CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD 32
 
 // Heap objects are allowed to be directly referenced only in VM code,
 // not in native code.
@@ -167,12 +170,42 @@
  * SUPPORT FUNCTIONS
  */
 
+/**
+ * Check whether or not a programmer has actually checked for exceptions. According
+ * to the JNI Specification ("jni/spec/design.html#java_exceptions"):
+ *
+ * There are two cases where the programmer needs to check for exceptions without
+ * being able to first check an error code:
+ *
+ * - The JNI functions that invoke a Java method return the result of the Java method.
+ * The programmer must call ExceptionOccurred() to check for possible exceptions
+ * that occurred during the execution of the Java method.
+ *
+ * - Some of the JNI array access functions do not return an error code, but may
+ * throw an ArrayIndexOutOfBoundsException or ArrayStoreException.
+ *
+ * In all other cases, a non-error return value guarantees that no exceptions have been thrown.
+ */
+static inline void
+check_pending_exception(JavaThread* thr) {
+  if (thr->has_pending_exception()) {
+    NativeReportJNIWarning(thr, "JNI call made with exception pending");
+  }
+  if (thr->is_pending_jni_exception_check()) {
+    IN_VM(
+      tty->print_cr("WARNING in native method: JNI call made without checking exceptions when required to from %s",
+        thr->get_pending_jni_exception_check());
+      thr->print_stack();
+    )
+    thr->clear_pending_jni_exception_check(); // Just complain once
+  }
+}
+
+
 static inline void
 functionEnterCritical(JavaThread* thr)
 {
-  if (thr->has_pending_exception()) {
-    NativeReportJNIWarning(thr, "JNI call made with exception pending");
-  }
+  check_pending_exception(thr);
 }
 
 static inline void
@@ -186,9 +219,7 @@
   if (thr->in_critical()) {
     tty->print_cr("%s", warn_other_function_in_critical);
   }
-  if (thr->has_pending_exception()) {
-    NativeReportJNIWarning(thr, "JNI call made with exception pending");
-  }
+  check_pending_exception(thr);
 }
 
 static inline void
@@ -200,9 +231,20 @@
 }
 
 static inline void
-functionExit(JNIEnv *env)
+functionExit(JavaThread* thr)
 {
-  /* nothing to do at this time */
+  JNIHandleBlock* handles = thr->active_handles();
+  size_t planned_capacity = handles->get_planned_capacity();
+  size_t live_handles = handles->get_number_of_live_handles();
+  if (live_handles > planned_capacity) {
+    IN_VM(
+      tty->print_cr("WARNING: JNI local refs: %zu, exceeds capacity: %zu",
+          live_handles, planned_capacity);
+      thr->print_stack();
+    )
+    // Complain just the once, reset to current + warn threshold
+    handles->set_planned_capacity(live_handles + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD);
+  }
 }
 
 static inline void
@@ -323,6 +365,74 @@
   }
 }
 
+/*
+ * Copy and wrap array elements for bounds checking.
+ * Remember the original elements (GuardedMemory::get_tag())
+ */
+static void* check_jni_wrap_copy_array(JavaThread* thr, jarray array,
+    void* orig_elements) {
+  void* result;
+  IN_VM(
+    oop a = JNIHandles::resolve_non_null(array);
+    size_t len = arrayOop(a)->length() <<
+        TypeArrayKlass::cast(a->klass())->log2_element_size();
+    result = GuardedMemory::wrap_copy(orig_elements, len, orig_elements);
+  )
+  return result;
+}
+
+static void* check_wrapped_array(JavaThread* thr, const char* fn_name,
+    void* obj, void* carray, size_t* rsz) {
+  if (carray == NULL) {
+    tty->print_cr("%s: elements vector NULL" PTR_FORMAT, fn_name, p2i(obj));
+    NativeReportJNIFatalError(thr, "Elements vector NULL");
+  }
+  GuardedMemory guarded(carray);
+  void* orig_result = guarded.get_tag();
+  if (!guarded.verify_guards()) {
+    tty->print_cr("ReleasePrimitiveArrayCritical: release array failed bounds "
+        "check, incorrect pointer returned ? array: " PTR_FORMAT " carray: "
+        PTR_FORMAT, p2i(obj), p2i(carray));
+    guarded.print_on(tty);
+    NativeReportJNIFatalError(thr, "ReleasePrimitiveArrayCritical: "
+        "failed bounds check");
+  }
+  if (orig_result == NULL) {
+    tty->print_cr("ReleasePrimitiveArrayCritical: unrecognized elements. array: "
+        PTR_FORMAT " carray: " PTR_FORMAT, p2i(obj), p2i(carray));
+    guarded.print_on(tty);
+    NativeReportJNIFatalError(thr, "ReleasePrimitiveArrayCritical: "
+        "unrecognized elements");
+  }
+  if (rsz != NULL) {
+    *rsz = guarded.get_user_size();
+  }
+  return orig_result;
+}
+
+static void* check_wrapped_array_release(JavaThread* thr, const char* fn_name,
+    void* obj, void* carray, jint mode) {
+  size_t sz;
+  void* orig_result = check_wrapped_array(thr, fn_name, obj, carray, &sz);
+  switch (mode) {
+  case 0:
+    memcpy(orig_result, carray, sz);
+    GuardedMemory::free_copy(carray);
+    break;
+  case JNI_COMMIT:
+    memcpy(orig_result, carray, sz);
+    break;
+  case JNI_ABORT:
+    GuardedMemory::free_copy(carray);
+    break;
+  default:
+    tty->print_cr("%s: Unrecognized mode %i releasing array "
+        PTR_FORMAT " elements " PTR_FORMAT, fn_name, mode, p2i(obj), p2i(carray));
+    NativeReportJNIFatalError(thr, "Unrecognized array release mode");
+  }
+  return orig_result;
+}
+
 oop jniCheck::validate_handle(JavaThread* thr, jobject obj) {
   if (JNIHandles::is_frame_handle(thr, obj) ||
       JNIHandles::is_local_handle(thr, obj) ||
@@ -439,7 +549,7 @@
       jniCheck::validate_object(thr, loader);
     )
     jclass result = UNCHECKED()->DefineClass(env, name, loader, buf, len);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -451,7 +561,7 @@
       jniCheck::validate_class_descriptor(thr, name);
     )
     jclass result = UNCHECKED()->FindClass(env, name);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -463,7 +573,7 @@
       jniCheck::validate_object(thr, method);
     )
     jmethodID result = UNCHECKED()->FromReflectedMethod(env, method);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -475,7 +585,7 @@
       jniCheck::validate_object(thr, field);
     )
     jfieldID result = UNCHECKED()->FromReflectedField(env, field);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -491,7 +601,7 @@
     )
     jobject result = UNCHECKED()->ToReflectedMethod(env, cls, methodID,
                                                     isStatic);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -503,7 +613,7 @@
       jniCheck::validate_class(thr, sub, true);
     )
     jclass result = UNCHECKED()->GetSuperclass(env, sub);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -517,7 +627,7 @@
       jniCheck::validate_class(thr, sup, true);
     )
     jboolean result = UNCHECKED()->IsAssignableFrom(env, sub, sup);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -532,7 +642,7 @@
     )
     jobject result = UNCHECKED()->ToReflectedField(env, cls, fieldID,
                                                    isStatic);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -550,7 +660,7 @@
       }
     )
     jint result = UNCHECKED()->Throw(env, obj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -565,15 +675,16 @@
       jniCheck::validate_throwable_klass(thr, k);
     )
     jint result = UNCHECKED()->ThrowNew(env, clazz, msg);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
 JNI_ENTRY_CHECKED(jthrowable,
   checked_jni_ExceptionOccurred(JNIEnv *env))
+    thr->clear_pending_jni_exception_check();
     functionEnterExceptionAllowed(thr);
     jthrowable result = UNCHECKED()->ExceptionOccurred(env);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -581,22 +692,24 @@
   checked_jni_ExceptionDescribe(JNIEnv *env))
     functionEnterExceptionAllowed(thr);
     UNCHECKED()->ExceptionDescribe(env);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
   checked_jni_ExceptionClear(JNIEnv *env))
+    thr->clear_pending_jni_exception_check();
     functionEnterExceptionAllowed(thr);
     UNCHECKED()->ExceptionClear(env);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
   checked_jni_FatalError(JNIEnv *env,
                          const char *msg))
+    thr->clear_pending_jni_exception_check();
     functionEnter(thr);
     UNCHECKED()->FatalError(env, msg);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jint,
@@ -606,7 +719,10 @@
     if (capacity < 0)
       NativeReportJNIFatalError(thr, "negative capacity");
     jint result = UNCHECKED()->PushLocalFrame(env, capacity);
-    functionExit(env);
+    if (result == JNI_OK) {
+      thr->active_handles()->set_planned_capacity(capacity + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD);
+    }
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -615,7 +731,7 @@
                             jobject result))
     functionEnterExceptionAllowed(thr);
     jobject res = UNCHECKED()->PopLocalFrame(env, result);
-    functionExit(env);
+    functionExit(thr);
     return res;
 JNI_END
 
@@ -629,7 +745,7 @@
       }
     )
     jobject result = UNCHECKED()->NewGlobalRef(env,lobj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -645,7 +761,7 @@
       }
     )
     UNCHECKED()->DeleteGlobalRef(env,gref);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -660,7 +776,7 @@
             "Invalid local JNI handle passed to DeleteLocalRef");
     )
     UNCHECKED()->DeleteLocalRef(env, obj);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jboolean,
@@ -681,7 +797,7 @@
       }
     )
     jboolean result = UNCHECKED()->IsSameObject(env,obj1,obj2);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -695,7 +811,7 @@
       }
     )
     jobject result = UNCHECKED()->NewLocalRef(env, ref);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -707,7 +823,10 @@
       NativeReportJNIFatalError(thr, "negative capacity");
     }
     jint result = UNCHECKED()->EnsureLocalCapacity(env, capacity);
-    functionExit(env);
+    if (result == JNI_OK) {
+      thr->active_handles()->set_planned_capacity(capacity + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD);
+    }
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -719,7 +838,7 @@
       jniCheck::validate_class(thr, clazz, false);
     )
     jobject result = UNCHECKED()->AllocObject(env,clazz);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -737,7 +856,7 @@
     va_start(args, methodID);
     jobject result = UNCHECKED()->NewObjectV(env,clazz,methodID,args);
     va_end(args);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -752,7 +871,7 @@
       jniCheck::validate_jmethod_id(thr, methodID);
     )
     jobject result = UNCHECKED()->NewObjectV(env,clazz,methodID,args);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -767,7 +886,7 @@
       jniCheck::validate_jmethod_id(thr, methodID);
     )
     jobject result = UNCHECKED()->NewObjectA(env,clazz,methodID,args);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -779,7 +898,7 @@
       jniCheck::validate_object(thr, obj);
     )
     jclass result = UNCHECKED()->GetObjectClass(env,obj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -793,7 +912,7 @@
       jniCheck::validate_class(thr, clazz, true);
     )
     jboolean result = UNCHECKED()->IsInstanceOf(env,obj,clazz);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -807,7 +926,7 @@
       jniCheck::validate_class(thr, clazz, false);
     )
     jmethodID result = UNCHECKED()->GetMethodID(env,clazz,name,sig);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -826,7 +945,8 @@
     ResultType result =UNCHECKED()->Call##Result##MethodV(env, obj, methodID, \
                                                           args); \
     va_end(args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("Call"#Result"Method"); \
+    functionExit(thr); \
     return result; \
 JNI_END \
 \
@@ -841,7 +961,8 @@
     ) \
     ResultType result = UNCHECKED()->Call##Result##MethodV(env, obj, methodID,\
                                                            args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("Call"#Result"MethodV"); \
+    functionExit(thr); \
     return result; \
 JNI_END \
 \
@@ -856,7 +977,8 @@
     ) \
     ResultType result = UNCHECKED()->Call##Result##MethodA(env, obj, methodID,\
                                                            args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("Call"#Result"MethodA"); \
+    functionExit(thr); \
     return result; \
 JNI_END
 
@@ -883,7 +1005,8 @@
     va_start(args,methodID);
     UNCHECKED()->CallVoidMethodV(env,obj,methodID,args);
     va_end(args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallVoidMethod");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -896,7 +1019,8 @@
       jniCheck::validate_call_object(thr, obj, methodID);
     )
     UNCHECKED()->CallVoidMethodV(env,obj,methodID,args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallVoidMethodV");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -909,7 +1033,8 @@
       jniCheck::validate_call_object(thr, obj, methodID);
     )
     UNCHECKED()->CallVoidMethodA(env,obj,methodID,args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallVoidMethodA");
+    functionExit(thr);
 JNI_END
 
 #define WRAPPER_CallNonvirtualMethod(ResultType, Result) \
@@ -932,7 +1057,8 @@
                                                                      methodID,\
                                                                      args); \
     va_end(args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("CallNonvirtual"#Result"Method"); \
+    functionExit(thr); \
     return result; \
 JNI_END \
 \
@@ -952,7 +1078,8 @@
                                                                      clazz, \
                                                                      methodID,\
                                                                      args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("CallNonvirtual"#Result"MethodV"); \
+    functionExit(thr); \
     return result; \
 JNI_END \
 \
@@ -972,7 +1099,8 @@
                                                                      clazz, \
                                                                      methodID,\
                                                                      args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("CallNonvirtual"#Result"MethodA"); \
+    functionExit(thr); \
     return result; \
 JNI_END
 
@@ -1001,7 +1129,8 @@
     va_start(args,methodID);
     UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args);
     va_end(args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallNonvirtualVoidMethod");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1016,7 +1145,8 @@
       jniCheck::validate_call_class(thr, clazz, methodID);
     )
     UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallNonvirtualVoidMethodV");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1031,7 +1161,8 @@
       jniCheck::validate_call_class(thr, clazz, methodID);
     )
     UNCHECKED()->CallNonvirtualVoidMethodA(env,obj,clazz,methodID,args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallNonvirtualVoidMethodA");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jfieldID,
@@ -1044,7 +1175,7 @@
       jniCheck::validate_class(thr, clazz, false);
     )
     jfieldID result = UNCHECKED()->GetFieldID(env,clazz,name,sig);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1058,7 +1189,7 @@
       checkInstanceFieldID(thr, fieldID, obj, FieldType); \
     ) \
     ReturnType result = UNCHECKED()->Get##Result##Field(env,obj,fieldID); \
-    functionExit(env); \
+    functionExit(thr); \
     return result; \
 JNI_END
 
@@ -1083,7 +1214,7 @@
       checkInstanceFieldID(thr, fieldID, obj, FieldType); \
     ) \
     UNCHECKED()->Set##Result##Field(env,obj,fieldID,val); \
-    functionExit(env); \
+    functionExit(thr); \
 JNI_END
 
 WRAPPER_SetField(jobject,  Object,  T_OBJECT)
@@ -1107,7 +1238,7 @@
       jniCheck::validate_class(thr, clazz, false);
     )
     jmethodID result = UNCHECKED()->GetStaticMethodID(env,clazz,name,sig);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1129,7 +1260,8 @@
                                                                  methodID, \
                                                                  args); \
     va_end(args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("CallStatic"#Result"Method"); \
+    functionExit(thr); \
     return result; \
 JNI_END \
 \
@@ -1147,7 +1279,8 @@
                                                                  clazz, \
                                                                  methodID, \
                                                                  args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("CallStatic"#Result"MethodV"); \
+    functionExit(thr); \
     return result; \
 JNI_END \
 \
@@ -1165,7 +1298,8 @@
                                                                  clazz, \
                                                                  methodID, \
                                                                  args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("CallStatic"#Result"MethodA"); \
+    functionExit(thr); \
     return result; \
 JNI_END
 
@@ -1193,7 +1327,8 @@
     va_start(args,methodID);
     UNCHECKED()->CallStaticVoidMethodV(env,cls,methodID,args);
     va_end(args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallStaticVoidMethod");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1207,7 +1342,8 @@
       jniCheck::validate_class(thr, cls, false);
     )
     UNCHECKED()->CallStaticVoidMethodV(env,cls,methodID,args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallStaticVoidMethodV");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1221,7 +1357,8 @@
       jniCheck::validate_class(thr, cls, false);
     )
     UNCHECKED()->CallStaticVoidMethodA(env,cls,methodID,args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallStaticVoidMethodA");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jfieldID,
@@ -1234,7 +1371,7 @@
       jniCheck::validate_class(thr, clazz, false);
     )
     jfieldID result = UNCHECKED()->GetStaticFieldID(env,clazz,name,sig);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1251,7 +1388,7 @@
     ReturnType result = UNCHECKED()->GetStatic##Result##Field(env, \
                                                               clazz, \
                                                               fieldID); \
-    functionExit(env); \
+    functionExit(thr); \
     return result; \
 JNI_END
 
@@ -1277,7 +1414,7 @@
       checkStaticFieldID(thr, fieldID, clazz, FieldType); \
     ) \
     UNCHECKED()->SetStatic##Result##Field(env,clazz,fieldID,value); \
-    functionExit(env); \
+    functionExit(thr); \
 JNI_END
 
 WRAPPER_SetStaticField(jobject,  Object,  T_OBJECT)
@@ -1297,7 +1434,7 @@
                         jsize len))
     functionEnter(thr);
     jstring result = UNCHECKED()->NewString(env,unicode,len);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1309,12 +1446,12 @@
       checkString(thr, str);
     )
     jsize result = UNCHECKED()->GetStringLength(env,str);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
 // Arbitrary (but well-known) tag
-const jint STRING_TAG = 0x47114711;
+const void* STRING_TAG = (void*)0x47114711;
 
 JNI_ENTRY_CHECKED(const jchar *,
   checked_jni_GetStringChars(JNIEnv *env,
@@ -1324,21 +1461,22 @@
     IN_VM(
       checkString(thr, str);
     )
-    jchar* newResult = NULL;
+    jchar* new_result = NULL;
     const jchar *result = UNCHECKED()->GetStringChars(env,str,isCopy);
     assert (isCopy == NULL || *isCopy == JNI_TRUE, "GetStringChars didn't return a copy as expected");
     if (result != NULL) {
       size_t len = UNCHECKED()->GetStringLength(env,str) + 1; // + 1 for NULL termination
-      jint* tagLocation = (jint*) AllocateHeap(len * sizeof(jchar) + sizeof(jint), mtInternal);
-      *tagLocation = STRING_TAG;
-      newResult = (jchar*) (tagLocation + 1);
-      memcpy(newResult, result, len * sizeof(jchar));
+      len *= sizeof(jchar);
+      new_result = (jchar*) GuardedMemory::wrap_copy(result, len, STRING_TAG);
+      if (new_result == NULL) {
+        vm_exit_out_of_memory(len, OOM_MALLOC_ERROR, "checked_jni_GetStringChars");
+      }
       // Avoiding call to UNCHECKED()->ReleaseStringChars() since that will fire unexpected dtrace probes
       // Note that the dtrace arguments for the allocated memory will not match up with this solution.
       FreeHeap((char*)result);
     }
-    functionExit(env);
-    return newResult;
+    functionExit(thr);
+    return new_result;
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1354,13 +1492,25 @@
        UNCHECKED()->ReleaseStringChars(env,str,chars);
     }
     else {
-       jint* tagLocation = ((jint*) chars) - 1;
-       if (*tagLocation != STRING_TAG) {
-          NativeReportJNIFatalError(thr, "ReleaseStringChars called on something not allocated by GetStringChars");
-       }
-       UNCHECKED()->ReleaseStringChars(env,str,(const jchar*)tagLocation);
+      GuardedMemory guarded((void*)chars);
+      if (!guarded.verify_guards()) {
+        tty->print_cr("ReleaseStringChars: release chars failed bounds check. "
+            "string: " PTR_FORMAT " chars: " PTR_FORMAT, p2i(str), p2i(chars));
+        guarded.print_on(tty);
+        NativeReportJNIFatalError(thr, "ReleaseStringChars: "
+            "release chars failed bounds check.");
+      }
+      if (guarded.get_tag() != STRING_TAG) {
+        tty->print_cr("ReleaseStringChars: called on something not allocated "
+            "by GetStringChars. string: " PTR_FORMAT " chars: " PTR_FORMAT,
+            p2i(str), p2i(chars));
+        NativeReportJNIFatalError(thr, "ReleaseStringChars called on something "
+            "not allocated by GetStringChars");
+      }
+       UNCHECKED()->ReleaseStringChars(env, str,
+           (const jchar*) guarded.release_for_freeing());
     }
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jstring,
@@ -1368,7 +1518,7 @@
                            const char *utf))
     functionEnter(thr);
     jstring result = UNCHECKED()->NewStringUTF(env,utf);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1380,12 +1530,12 @@
       checkString(thr, str);
     )
     jsize result = UNCHECKED()->GetStringUTFLength(env,str);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
 // Arbitrary (but well-known) tag - different than GetStringChars
-const jint STRING_UTF_TAG = 0x48124812;
+const void* STRING_UTF_TAG = (void*) 0x48124812;
 
 JNI_ENTRY_CHECKED(const char *,
   checked_jni_GetStringUTFChars(JNIEnv *env,
@@ -1395,21 +1545,21 @@
     IN_VM(
       checkString(thr, str);
     )
-    char* newResult = NULL;
+    char* new_result = NULL;
     const char *result = UNCHECKED()->GetStringUTFChars(env,str,isCopy);
     assert (isCopy == NULL || *isCopy == JNI_TRUE, "GetStringUTFChars didn't return a copy as expected");
     if (result != NULL) {
       size_t len = strlen(result) + 1; // + 1 for NULL termination
-      jint* tagLocation = (jint*) AllocateHeap(len + sizeof(jint), mtInternal);
-      *tagLocation = STRING_UTF_TAG;
-      newResult = (char*) (tagLocation + 1);
-      strcpy(newResult, result);
+      new_result = (char*) GuardedMemory::wrap_copy(result, len, STRING_UTF_TAG);
+      if (new_result == NULL) {
+        vm_exit_out_of_memory(len, OOM_MALLOC_ERROR, "checked_jni_GetStringUTFChars");
+      }
       // Avoiding call to UNCHECKED()->ReleaseStringUTFChars() since that will fire unexpected dtrace probes
       // Note that the dtrace arguments for the allocated memory will not match up with this solution.
       FreeHeap((char*)result, mtInternal);
     }
-    functionExit(env);
-    return newResult;
+    functionExit(thr);
+    return new_result;
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1425,13 +1575,25 @@
        UNCHECKED()->ReleaseStringUTFChars(env,str,chars);
     }
     else {
-       jint* tagLocation = ((jint*) chars) - 1;
-       if (*tagLocation != STRING_UTF_TAG) {
-          NativeReportJNIFatalError(thr, "ReleaseStringUTFChars called on something not allocated by GetStringUTFChars");
-       }
-       UNCHECKED()->ReleaseStringUTFChars(env,str,(const char*)tagLocation);
+      GuardedMemory guarded((void*)chars);
+      if (!guarded.verify_guards()) {
+        tty->print_cr("ReleaseStringUTFChars: release chars failed bounds check. "
+            "string: " PTR_FORMAT " chars: " PTR_FORMAT, p2i(str), p2i(chars));
+        guarded.print_on(tty);
+        NativeReportJNIFatalError(thr, "ReleaseStringUTFChars: "
+            "release chars failed bounds check.");
+      }
+      if (guarded.get_tag() != STRING_UTF_TAG) {
+        tty->print_cr("ReleaseStringUTFChars: called on something not "
+            "allocated by GetStringUTFChars. string: " PTR_FORMAT " chars: "
+            PTR_FORMAT, p2i(str), p2i(chars));
+        NativeReportJNIFatalError(thr, "ReleaseStringUTFChars "
+            "called on something not allocated by GetStringUTFChars");
+      }
+      UNCHECKED()->ReleaseStringUTFChars(env, str,
+          (const char*) guarded.release_for_freeing());
     }
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jsize,
@@ -1442,7 +1604,7 @@
       check_is_array(thr, array);
     )
     jsize result = UNCHECKED()->GetArrayLength(env,array);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1453,7 +1615,7 @@
                              jobject init))
     functionEnter(thr);
     jobjectArray result = UNCHECKED()->NewObjectArray(env,len,clazz,init);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1466,7 +1628,8 @@
       check_is_obj_array(thr, array);
     )
     jobject result = UNCHECKED()->GetObjectArrayElement(env,array,index);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("GetObjectArrayElement");
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1480,7 +1643,8 @@
       check_is_obj_array(thr, array);
     )
     UNCHECKED()->SetObjectArrayElement(env,array,index,val);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("SetObjectArrayElement");
+    functionExit(thr);
 JNI_END
 
 #define WRAPPER_NewScalarArray(Return, Result) \
@@ -1489,7 +1653,7 @@
                                  jsize len)) \
     functionEnter(thr); \
     Return result = UNCHECKED()->New##Result##Array(env,len); \
-    functionExit(env); \
+    functionExit(thr); \
     return (Return) result; \
 JNI_END
 
@@ -1514,7 +1678,10 @@
     ElementType *result = UNCHECKED()->Get##Result##ArrayElements(env, \
                                                                   array, \
                                                                   isCopy); \
-    functionExit(env); \
+    if (result != NULL) { \
+      result = (ElementType *) check_jni_wrap_copy_array(thr, array, result); \
+    } \
+    functionExit(thr); \
     return result; \
 JNI_END
 
@@ -1538,13 +1705,11 @@
       check_primitive_array_type(thr, array, ElementTag); \
       ASSERT_OOPS_ALLOWED; \
       typeArrayOop a = typeArrayOop(JNIHandles::resolve_non_null(array)); \
-      /* cannot check validity of copy, unless every request is logged by
-       * checking code.  Implementation of this check is deferred until a
-       * subsequent release.
-       */ \
     ) \
-    UNCHECKED()->Release##Result##ArrayElements(env,array,elems,mode); \
-    functionExit(env); \
+    ElementType* orig_result = (ElementType *) check_wrapped_array_release( \
+        thr, "checked_jni_Release"#Result"ArrayElements", array, elems, mode); \
+    UNCHECKED()->Release##Result##ArrayElements(env, array, orig_result, mode); \
+    functionExit(thr); \
 JNI_END
 
 WRAPPER_ReleaseScalarArrayElements(T_BOOLEAN,jboolean, Boolean, bool)
@@ -1568,7 +1733,8 @@
       check_primitive_array_type(thr, array, ElementTag); \
     ) \
     UNCHECKED()->Get##Result##ArrayRegion(env,array,start,len,buf); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("Get"#Result"ArrayRegion"); \
+    functionExit(thr); \
 JNI_END
 
 WRAPPER_GetScalarArrayRegion(T_BOOLEAN, jboolean, Boolean)
@@ -1592,7 +1758,8 @@
       check_primitive_array_type(thr, array, ElementTag); \
     ) \
     UNCHECKED()->Set##Result##ArrayRegion(env,array,start,len,buf); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("Set"#Result"ArrayRegion"); \
+    functionExit(thr); \
 JNI_END
 
 WRAPPER_SetScalarArrayRegion(T_BOOLEAN, jboolean, Boolean)
@@ -1611,7 +1778,7 @@
                               jint nMethods))
     functionEnter(thr);
     jint result = UNCHECKED()->RegisterNatives(env,clazz,methods,nMethods);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1620,7 +1787,7 @@
                                 jclass clazz))
     functionEnter(thr);
     jint result = UNCHECKED()->UnregisterNatives(env,clazz);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1632,7 +1799,7 @@
       jniCheck::validate_object(thr, obj);
     )
     jint result = UNCHECKED()->MonitorEnter(env,obj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1644,7 +1811,7 @@
       jniCheck::validate_object(thr, obj);
     )
     jint result = UNCHECKED()->MonitorExit(env,obj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1653,7 +1820,7 @@
                         JavaVM **vm))
     functionEnter(thr);
     jint result = UNCHECKED()->GetJavaVM(env,vm);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1668,7 +1835,8 @@
       checkString(thr, str);
     )
     UNCHECKED()->GetStringRegion(env, str, start, len, buf);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("GetStringRegion");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1682,7 +1850,8 @@
       checkString(thr, str);
     )
     UNCHECKED()->GetStringUTFRegion(env, str, start, len, buf);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("GetStringUTFRegion");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void *,
@@ -1694,7 +1863,10 @@
       check_is_primitive_array(thr, array);
     )
     void *result = UNCHECKED()->GetPrimitiveArrayCritical(env, array, isCopy);
-    functionExit(env);
+    if (result != NULL) {
+      result = check_jni_wrap_copy_array(thr, array, result);
+    }
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1707,11 +1879,10 @@
     IN_VM(
       check_is_primitive_array(thr, array);
     )
-    /* The Hotspot JNI code does not use the parameters, so just check the
-     * array parameter as a minor sanity check
-     */
-    UNCHECKED()->ReleasePrimitiveArrayCritical(env, array, carray, mode);
-    functionExit(env);
+    // Check the element array...
+    void* orig_result = check_wrapped_array_release(thr, "ReleasePrimitiveArrayCritical", array, carray, mode);
+    UNCHECKED()->ReleasePrimitiveArrayCritical(env, array, orig_result, mode);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(const jchar*,
@@ -1723,7 +1894,7 @@
       checkString(thr, string);
     )
     const jchar *result = UNCHECKED()->GetStringCritical(env, string, isCopy);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1739,7 +1910,7 @@
      * string parameter as a minor sanity check
      */
     UNCHECKED()->ReleaseStringCritical(env, str, chars);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jweak,
@@ -1752,7 +1923,7 @@
       }
     )
     jweak result = UNCHECKED()->NewWeakGlobalRef(env, obj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1761,14 +1932,15 @@
                                   jweak ref))
     functionEnterExceptionAllowed(thr);
     UNCHECKED()->DeleteWeakGlobalRef(env, ref);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jboolean,
   checked_jni_ExceptionCheck(JNIEnv *env))
+    thr->clear_pending_jni_exception_check();
     functionEnterExceptionAllowed(thr);
     jboolean result = UNCHECKED()->ExceptionCheck(env);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1778,7 +1950,7 @@
                                   jlong capacity))
     functionEnter(thr);
     jobject result = UNCHECKED()->NewDirectByteBuffer(env, address, capacity);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1787,7 +1959,7 @@
                                      jobject buf))
     functionEnter(thr);
     void* result = UNCHECKED()->GetDirectBufferAddress(env, buf);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1796,7 +1968,7 @@
                                       jobject buf))
     functionEnter(thr);
     jlong result = UNCHECKED()->GetDirectBufferCapacity(env, buf);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1809,7 +1981,7 @@
       jniCheck::validate_object(thr, obj);
     )
     jobjectRefType result = UNCHECKED()->GetObjectRefType(env, obj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1818,7 +1990,7 @@
   checked_jni_GetVersion(JNIEnv *env))
     functionEnter(thr);
     jint result = UNCHECKED()->GetVersion(env);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
--- a/hotspot/src/share/vm/prims/jvm.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -3923,50 +3923,6 @@
 }
 
 
-// Support for Serialization
-
-typedef jfloat  (JNICALL *IntBitsToFloatFn  )(JNIEnv* env, jclass cb, jint    value);
-typedef jdouble (JNICALL *LongBitsToDoubleFn)(JNIEnv* env, jclass cb, jlong   value);
-typedef jint    (JNICALL *FloatToIntBitsFn  )(JNIEnv* env, jclass cb, jfloat  value);
-typedef jlong   (JNICALL *DoubleToLongBitsFn)(JNIEnv* env, jclass cb, jdouble value);
-
-static IntBitsToFloatFn   int_bits_to_float_fn   = NULL;
-static LongBitsToDoubleFn long_bits_to_double_fn = NULL;
-static FloatToIntBitsFn   float_to_int_bits_fn   = NULL;
-static DoubleToLongBitsFn double_to_long_bits_fn = NULL;
-
-
-void initialize_converter_functions() {
-  if (JDK_Version::is_gte_jdk14x_version()) {
-    // These functions only exist for compatibility with 1.3.1 and earlier
-    return;
-  }
-
-  // called from universe_post_init()
-  assert(
-    int_bits_to_float_fn   == NULL &&
-    long_bits_to_double_fn == NULL &&
-    float_to_int_bits_fn   == NULL &&
-    double_to_long_bits_fn == NULL ,
-    "initialization done twice"
-  );
-  // initialize
-  int_bits_to_float_fn   = CAST_TO_FN_PTR(IntBitsToFloatFn  , NativeLookup::base_library_lookup("java/lang/Float" , "intBitsToFloat"  , "(I)F"));
-  long_bits_to_double_fn = CAST_TO_FN_PTR(LongBitsToDoubleFn, NativeLookup::base_library_lookup("java/lang/Double", "longBitsToDouble", "(J)D"));
-  float_to_int_bits_fn   = CAST_TO_FN_PTR(FloatToIntBitsFn  , NativeLookup::base_library_lookup("java/lang/Float" , "floatToIntBits"  , "(F)I"));
-  double_to_long_bits_fn = CAST_TO_FN_PTR(DoubleToLongBitsFn, NativeLookup::base_library_lookup("java/lang/Double", "doubleToLongBits", "(D)J"));
-  // verify
-  assert(
-    int_bits_to_float_fn   != NULL &&
-    long_bits_to_double_fn != NULL &&
-    float_to_int_bits_fn   != NULL &&
-    double_to_long_bits_fn != NULL ,
-    "initialization failed"
-  );
-}
-
-
-
 // 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) {
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -185,64 +185,7 @@
 
 // Get/SetObject must be special-cased, since it works with handles.
 
-// The xxx140 variants for backward compatibility do not allow a full-width offset.
-UNSAFE_ENTRY(jobject, Unsafe_GetObject140(JNIEnv *env, jobject unsafe, jobject obj, jint offset))
-  UnsafeWrapper("Unsafe_GetObject");
-  if (obj == NULL)  THROW_0(vmSymbols::java_lang_NullPointerException());
-  GET_OOP_FIELD(obj, offset, v)
-  jobject ret = JNIHandles::make_local(env, v);
-#if INCLUDE_ALL_GCS
-  // We could be accessing the referent field in a reference
-  // object. If G1 is enabled then we need to register a non-null
-  // referent with the SATB barrier.
-  if (UseG1GC) {
-    bool needs_barrier = false;
-
-    if (ret != NULL) {
-      if (offset == java_lang_ref_Reference::referent_offset) {
-        oop o = JNIHandles::resolve_non_null(obj);
-        Klass* k = o->klass();
-        if (InstanceKlass::cast(k)->reference_type() != REF_NONE) {
-          assert(InstanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity");
-          needs_barrier = true;
-        }
-      }
-    }
-
-    if (needs_barrier) {
-      oop referent = JNIHandles::resolve(ret);
-      G1SATBCardTableModRefBS::enqueue(referent);
-    }
-  }
-#endif // INCLUDE_ALL_GCS
-  return ret;
-UNSAFE_END
-
-UNSAFE_ENTRY(void, Unsafe_SetObject140(JNIEnv *env, jobject unsafe, jobject obj, jint offset, jobject x_h))
-  UnsafeWrapper("Unsafe_SetObject");
-  if (obj == NULL)  THROW(vmSymbols::java_lang_NullPointerException());
-  oop x = JNIHandles::resolve(x_h);
-  //SET_FIELD(obj, offset, oop, x);
-  oop p = JNIHandles::resolve(obj);
-  if (UseCompressedOops) {
-    if (x != NULL) {
-      // If there is a heap base pointer, we are obliged to emit a store barrier.
-      oop_store((narrowOop*)index_oop_from_field_offset_long(p, offset), x);
-    } else {
-      narrowOop n = oopDesc::encode_heap_oop_not_null(x);
-      *(narrowOop*)index_oop_from_field_offset_long(p, offset) = n;
-    }
-  } else {
-    if (x != NULL) {
-      // If there is a heap base pointer, we are obliged to emit a store barrier.
-      oop_store((oop*)index_oop_from_field_offset_long(p, offset), x);
-    } else {
-      *(oop*)index_oop_from_field_offset_long(p, offset) = x;
-    }
-  }
-UNSAFE_END
-
-// The normal variants allow a null base pointer with an arbitrary address.
+// These functions allow a null base pointer with an arbitrary address.
 // But if the base pointer is non-null, the offset should make some sense.
 // That is, it should be in the range [0, MAX_OBJECT_SIZE].
 UNSAFE_ENTRY(jobject, Unsafe_GetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset))
@@ -1350,9 +1293,6 @@
 
 // These are the methods for 1.4.0
 static JNINativeMethod methods_140[] = {
-    {CC"getObject",        CC"("OBJ"I)"OBJ"",   FN_PTR(Unsafe_GetObject140)},
-    {CC"putObject",        CC"("OBJ"I"OBJ")V",  FN_PTR(Unsafe_SetObject140)},
-
     DECLARE_GETSETOOP_140(Boolean, Z),
     DECLARE_GETSETOOP_140(Byte, B),
     DECLARE_GETSETOOP_140(Short, S),
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -222,10 +222,8 @@
   const char* spec_vendor = "Sun Microsystems Inc.";
   uint32_t spec_version = 0;
 
-  if (JDK_Version::is_gte_jdk17x_version()) {
-    spec_vendor = "Oracle Corporation";
-    spec_version = JDK_Version::current().major_version();
-  }
+  spec_vendor = "Oracle Corporation";
+  spec_version = JDK_Version::current().major_version();
   jio_snprintf(buffer, bufsz, "1." UINT32_FORMAT, spec_version);
 
   PropertyList_add(&_system_properties,
@@ -2455,6 +2453,8 @@
     warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");
   }
 
+  status &= check_vm_args_consistency_ext();
+
   return status;
 }
 
@@ -3699,14 +3699,6 @@
     PrintGC = true;
   }
 
-  if (!JDK_Version::is_gte_jdk18x_version()) {
-    // To avoid changing the log format for 7 updates this flag is only
-    // true by default in JDK8 and above.
-    if (FLAG_IS_DEFAULT(PrintGCCause)) {
-      FLAG_SET_DEFAULT(PrintGCCause, false);
-    }
-  }
-
   // Set object alignment values.
   set_object_alignment();
 
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -462,6 +462,7 @@
   static void check_deprecated_gc_flags();
   // Check consistency or otherwise of VM argument settings
   static bool check_vm_args_consistency();
+  static bool check_vm_args_consistency_ext();
   // Check stack pages settings
   static bool check_stack_pages();
   // Used by os_solaris
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/runtime/arguments_ext.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "runtime/arguments.hpp"
+
+bool Arguments::check_vm_args_consistency_ext() {
+  return true;
+}
--- a/hotspot/src/share/vm/runtime/atomic.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/atomic.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -116,7 +116,7 @@
     atomic_decl
 #else
 #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl) \
-    atomic_decl ; \
+    atomic_decl; \
     non_atomic_decl
 #endif
 
--- a/hotspot/src/share/vm/runtime/java.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/java.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -501,9 +501,6 @@
     os::infinite_sleep();
   }
 
-  // Stop any ongoing concurrent GC work
-  Universe::heap()->stop();
-
   // Terminate watcher thread - must before disenrolling any periodic task
   if (PeriodicTask::num_tasks() > 0)
     WatcherThread::stop();
@@ -518,10 +515,8 @@
   StatSampler::disengage();
   StatSampler::destroy();
 
-  // We do not need to explicitly stop concurrent GC threads because the
-  // JVM will be taken down at a safepoint when such threads are inactive --
-  // except for some concurrent G1 threads, see (comment in)
-  // Threads::destroy_vm().
+  // Stop concurrent GC threads
+  Universe::heap()->stop();
 
   // Print GC/heap related information.
   if (PrintGCDetails) {
--- a/hotspot/src/share/vm/runtime/java.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/java.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -197,58 +197,6 @@
     _runtime_version = version;
   }
 
-  // Convenience methods for queries on the current major/minor version
-  static bool is_jdk12x_version() {
-    return current().compare_major(2) == 0;
-  }
-
-  static bool is_jdk13x_version() {
-    return current().compare_major(3) == 0;
-  }
-
-  static bool is_jdk14x_version() {
-    return current().compare_major(4) == 0;
-  }
-
-  static bool is_jdk15x_version() {
-    return current().compare_major(5) == 0;
-  }
-
-  static bool is_jdk16x_version() {
-    return current().compare_major(6) == 0;
-  }
-
-  static bool is_jdk17x_version() {
-    return current().compare_major(7) == 0;
-  }
-
-  static bool is_jdk18x_version() {
-    return current().compare_major(8) == 0;
-  }
-
-  static bool is_gte_jdk13x_version() {
-    return current().compare_major(3) >= 0;
-  }
-
-  static bool is_gte_jdk14x_version() {
-    return current().compare_major(4) >= 0;
-  }
-
-  static bool is_gte_jdk15x_version() {
-    return current().compare_major(5) >= 0;
-  }
-
-  static bool is_gte_jdk16x_version() {
-    return current().compare_major(6) >= 0;
-  }
-
-  static bool is_gte_jdk17x_version() {
-    return current().compare_major(7) >= 0;
-  }
-
-  static bool is_gte_jdk18x_version() {
-    return current().compare_major(8) >= 0;
-  }
 };
 
 #endif // SHARE_VM_RUNTIME_JAVA_HPP
--- a/hotspot/src/share/vm/runtime/jniHandles.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/jniHandles.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -298,6 +298,7 @@
   block->_top  = 0;
   block->_next = NULL;
   block->_pop_frame_link = NULL;
+  block->_planned_capacity = block_size_in_oops;
   // _last, _free_list & _allocate_before_rebuild initialized in allocate_handle
   debug_only(block->_last = NULL);
   debug_only(block->_free_list = NULL);
@@ -531,6 +532,12 @@
   return result;
 }
 
+const size_t JNIHandleBlock::get_number_of_live_handles() {
+  CountHandleClosure counter;
+  oops_do(&counter);
+  return counter.count();
+}
+
 // This method is not thread-safe, i.e., must be called while holding a lock on the
 // structure.
 long JNIHandleBlock::memory_usage() const {
--- a/hotspot/src/share/vm/runtime/jniHandles.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/jniHandles.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,6 +112,9 @@
   oop*            _free_list;                   // Handle free list
   int             _allocate_before_rebuild;     // Number of blocks to allocate before rebuilding free list
 
+  // Check JNI, "planned capacity" for current frame (or push/ensure)
+  size_t          _planned_capacity;
+
   #ifndef PRODUCT
   JNIHandleBlock* _block_list_link;             // Link for list below
   static JNIHandleBlock* _block_list;           // List of all allocated blocks (for debugging only)
@@ -152,6 +155,11 @@
   // Traversal of weak handles. Unreachable oops are cleared.
   void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f);
 
+  // Checked JNI support
+  void set_planned_capacity(size_t planned_capacity) { _planned_capacity = planned_capacity; }
+  const size_t get_planned_capacity() { return _planned_capacity; }
+  const size_t get_number_of_live_handles();
+
   // Debugging
   bool chain_contains(jobject handle) const;    // Does this block or following blocks contain handle
   bool contains(jobject handle) const;          // Does this block contain handle
--- a/hotspot/src/share/vm/runtime/mutex.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/mutex.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -269,62 +269,62 @@
 
 #define CASPTR(a,c,s) intptr_t(Atomic::cmpxchg_ptr ((void *)(s),(void *)(a),(void *)(c)))
 #define UNS(x) (uintptr_t(x))
-#define TRACE(m) { static volatile int ctr = 0 ; int x = ++ctr ; if ((x & (x-1))==0) { ::printf ("%d:%s\n", x, #m); ::fflush(stdout); }}
+#define TRACE(m) { static volatile int ctr = 0; int x = ++ctr; if ((x & (x-1))==0) { ::printf ("%d:%s\n", x, #m); ::fflush(stdout); }}
 
 // Simplistic low-quality Marsaglia SHIFT-XOR RNG.
 // Bijective except for the trailing mask operation.
 // Useful for spin loops as the compiler can't optimize it away.
 
 static inline jint MarsagliaXORV (jint x) {
-  if (x == 0) x = 1|os::random() ;
+  if (x == 0) x = 1|os::random();
   x ^= x << 6;
   x ^= ((unsigned)x) >> 21;
-  x ^= x << 7 ;
-  return x & 0x7FFFFFFF ;
+  x ^= x << 7;
+  return x & 0x7FFFFFFF;
 }
 
 static int Stall (int its) {
-  static volatile jint rv = 1 ;
-  volatile int OnFrame = 0 ;
-  jint v = rv ^ UNS(OnFrame) ;
+  static volatile jint rv = 1;
+  volatile int OnFrame = 0;
+  jint v = rv ^ UNS(OnFrame);
   while (--its >= 0) {
-    v = MarsagliaXORV (v) ;
+    v = MarsagliaXORV(v);
   }
   // Make this impossible for the compiler to optimize away,
   // but (mostly) avoid W coherency sharing on MP systems.
-  if (v == 0x12345) rv = v ;
-  return v ;
+  if (v == 0x12345) rv = v;
+  return v;
 }
 
-int Monitor::TryLock () {
-  intptr_t v = _LockWord.FullWord ;
+int Monitor::TryLock() {
+  intptr_t v = _LockWord.FullWord;
   for (;;) {
-    if ((v & _LBIT) != 0) return 0 ;
-    const intptr_t u = CASPTR (&_LockWord, v, v|_LBIT) ;
-    if (v == u) return 1 ;
-    v = u ;
+    if ((v & _LBIT) != 0) return 0;
+    const intptr_t u = CASPTR(&_LockWord, v, v|_LBIT);
+    if (v == u) return 1;
+    v = u;
   }
 }
 
-int Monitor::TryFast () {
+int Monitor::TryFast() {
   // Optimistic fast-path form ...
   // Fast-path attempt for the common uncontended case.
   // Avoid RTS->RTO $ coherence upgrade on typical SMP systems.
-  intptr_t v = CASPTR (&_LockWord, 0, _LBIT) ;  // agro ...
-  if (v == 0) return 1 ;
+  intptr_t v = CASPTR(&_LockWord, 0, _LBIT);  // agro ...
+  if (v == 0) return 1;
 
   for (;;) {
-    if ((v & _LBIT) != 0) return 0 ;
-    const intptr_t u = CASPTR (&_LockWord, v, v|_LBIT) ;
-    if (v == u) return 1 ;
-    v = u ;
+    if ((v & _LBIT) != 0) return 0;
+    const intptr_t u = CASPTR(&_LockWord, v, v|_LBIT);
+    if (v == u) return 1;
+    v = u;
   }
 }
 
-int Monitor::ILocked () {
-  const intptr_t w = _LockWord.FullWord & 0xFF ;
-  assert (w == 0 || w == _LBIT, "invariant") ;
-  return w == _LBIT ;
+int Monitor::ILocked() {
+  const intptr_t w = _LockWord.FullWord & 0xFF;
+  assert(w == 0 || w == _LBIT, "invariant");
+  return w == _LBIT;
 }
 
 // Polite TATAS spinlock with exponential backoff - bounded spin.
@@ -342,38 +342,38 @@
 // See synchronizer.cpp for details and rationale.
 
 int Monitor::TrySpin (Thread * const Self) {
-  if (TryLock())    return 1 ;
-  if (!os::is_MP()) return 0 ;
+  if (TryLock())    return 1;
+  if (!os::is_MP()) return 0;
 
-  int Probes  = 0 ;
-  int Delay   = 0 ;
-  int Steps   = 0 ;
-  int SpinMax = NativeMonitorSpinLimit ;
-  int flgs    = NativeMonitorFlags ;
+  int Probes  = 0;
+  int Delay   = 0;
+  int Steps   = 0;
+  int SpinMax = NativeMonitorSpinLimit;
+  int flgs    = NativeMonitorFlags;
   for (;;) {
     intptr_t v = _LockWord.FullWord;
     if ((v & _LBIT) == 0) {
       if (CASPTR (&_LockWord, v, v|_LBIT) == v) {
-        return 1 ;
+        return 1;
       }
-      continue ;
+      continue;
     }
 
     if ((flgs & 8) == 0) {
-      SpinPause () ;
+      SpinPause();
     }
 
     // Periodically increase Delay -- variable Delay form
     // conceptually: delay *= 1 + 1/Exponent
-    ++ Probes;
-    if (Probes > SpinMax) return 0 ;
+    ++Probes;
+    if (Probes > SpinMax) return 0;
 
     if ((Probes & 0x7) == 0) {
-      Delay = ((Delay << 1)|1) & 0x7FF ;
+      Delay = ((Delay << 1)|1) & 0x7FF;
       // CONSIDER: Delay += 1 + (Delay/4); Delay &= 0x7FF ;
     }
 
-    if (flgs & 2) continue ;
+    if (flgs & 2) continue;
 
     // Consider checking _owner's schedctl state, if OFFPROC abort spin.
     // If the owner is OFFPROC then it's unlike that the lock will be dropped
@@ -389,48 +389,48 @@
     // spin loop.  N1 and brethren write-around the L1$ over the xbar into the L2$.
     // Furthermore, they don't have a W$ like traditional SPARC processors.
     // We currently use a Marsaglia Shift-Xor RNG loop.
-    Steps += Delay ;
+    Steps += Delay;
     if (Self != NULL) {
-      jint rv = Self->rng[0] ;
-      for (int k = Delay ; --k >= 0; ) {
-        rv = MarsagliaXORV (rv) ;
-        if ((flgs & 4) == 0 && SafepointSynchronize::do_call_back()) return 0 ;
+      jint rv = Self->rng[0];
+      for (int k = Delay; --k >= 0;) {
+        rv = MarsagliaXORV(rv);
+        if ((flgs & 4) == 0 && SafepointSynchronize::do_call_back()) return 0;
       }
-      Self->rng[0] = rv ;
+      Self->rng[0] = rv;
     } else {
-      Stall (Delay) ;
+      Stall(Delay);
     }
   }
 }
 
 static int ParkCommon (ParkEvent * ev, jlong timo) {
   // Diagnostic support - periodically unwedge blocked threads
-  intx nmt = NativeMonitorTimeout ;
+  intx nmt = NativeMonitorTimeout;
   if (nmt > 0 && (nmt < timo || timo <= 0)) {
-     timo = nmt ;
+     timo = nmt;
   }
-  int err = OS_OK ;
+  int err = OS_OK;
   if (0 == timo) {
-    ev->park() ;
+    ev->park();
   } else {
-    err = ev->park(timo) ;
+    err = ev->park(timo);
   }
-  return err ;
+  return err;
 }
 
 inline int Monitor::AcquireOrPush (ParkEvent * ESelf) {
-  intptr_t v = _LockWord.FullWord ;
+  intptr_t v = _LockWord.FullWord;
   for (;;) {
     if ((v & _LBIT) == 0) {
-      const intptr_t u = CASPTR (&_LockWord, v, v|_LBIT) ;
-      if (u == v) return 1 ;        // indicate acquired
-      v = u ;
+      const intptr_t u = CASPTR(&_LockWord, v, v|_LBIT);
+      if (u == v) return 1;        // indicate acquired
+      v = u;
     } else {
       // Anticipate success ...
-      ESelf->ListNext = (ParkEvent *) (v & ~_LBIT) ;
-      const intptr_t u = CASPTR (&_LockWord, v, intptr_t(ESelf)|_LBIT) ;
-      if (u == v) return 0 ;        // indicate pushed onto cxq
-      v = u ;
+      ESelf->ListNext = (ParkEvent *)(v & ~_LBIT);
+      const intptr_t u = CASPTR(&_LockWord, v, intptr_t(ESelf)|_LBIT);
+      if (u == v) return 0;        // indicate pushed onto cxq
+      v = u;
     }
     // Interference - LockWord change - just retry
   }
@@ -444,33 +444,33 @@
 // _owner is a higher-level logical concept.
 
 void Monitor::ILock (Thread * Self) {
-  assert (_OnDeck != Self->_MutexEvent, "invariant") ;
+  assert(_OnDeck != Self->_MutexEvent, "invariant");
 
   if (TryFast()) {
  Exeunt:
-    assert (ILocked(), "invariant") ;
-    return ;
+    assert(ILocked(), "invariant");
+    return;
   }
 
-  ParkEvent * const ESelf = Self->_MutexEvent ;
-  assert (_OnDeck != ESelf, "invariant") ;
+  ParkEvent * const ESelf = Self->_MutexEvent;
+  assert(_OnDeck != ESelf, "invariant");
 
   // As an optimization, spinners could conditionally try to set ONDECK to _LBIT
   // Synchronizer.cpp uses a similar optimization.
-  if (TrySpin (Self)) goto Exeunt ;
+  if (TrySpin(Self)) goto Exeunt;
 
   // Slow-path - the lock is contended.
   // Either Enqueue Self on cxq or acquire the outer lock.
   // LockWord encoding = (cxq,LOCKBYTE)
-  ESelf->reset() ;
-  OrderAccess::fence() ;
+  ESelf->reset();
+  OrderAccess::fence();
 
   // Optional optimization ... try barging on the inner lock
   if ((NativeMonitorFlags & 32) && CASPTR (&_OnDeck, NULL, UNS(Self)) == 0) {
-    goto OnDeck_LOOP ;
+    goto OnDeck_LOOP;
   }
 
-  if (AcquireOrPush (ESelf)) goto Exeunt ;
+  if (AcquireOrPush(ESelf)) goto Exeunt;
 
   // At any given time there is at most one ondeck thread.
   // ondeck implies not resident on cxq and not resident on EntryList
@@ -478,26 +478,26 @@
   // CONSIDER: use Self->OnDeck instead of m->OnDeck.
   // Deschedule Self so that others may run.
   while (_OnDeck != ESelf) {
-    ParkCommon (ESelf, 0) ;
+    ParkCommon(ESelf, 0);
   }
 
   // Self is now in the ONDECK position and will remain so until it
   // manages to acquire the lock.
  OnDeck_LOOP:
   for (;;) {
-    assert (_OnDeck == ESelf, "invariant") ;
-    if (TrySpin (Self)) break ;
+    assert(_OnDeck == ESelf, "invariant");
+    if (TrySpin(Self)) break;
     // CONSIDER: if ESelf->TryPark() && TryLock() break ...
     // It's probably wise to spin only if we *actually* blocked
     // CONSIDER: check the lockbyte, if it remains set then
     // preemptively drain the cxq into the EntryList.
     // The best place and time to perform queue operations -- lock metadata --
     // is _before having acquired the outer lock, while waiting for the lock to drop.
-    ParkCommon (ESelf, 0) ;
+    ParkCommon(ESelf, 0);
   }
 
-  assert (_OnDeck == ESelf, "invariant") ;
-  _OnDeck = NULL ;
+  assert(_OnDeck == ESelf, "invariant");
+  _OnDeck = NULL;
 
   // Note that we current drop the inner lock (clear OnDeck) in the slow-path
   // epilogue immediately after having acquired the outer lock.
@@ -512,11 +512,11 @@
   //    effective length of the critical section.
   // Note that (A) and (B) are tantamount to succession by direct handoff for
   // the inner lock.
-  goto Exeunt ;
+  goto Exeunt;
 }
 
 void Monitor::IUnlock (bool RelaxAssert) {
-  assert (ILocked(), "invariant") ;
+  assert(ILocked(), "invariant");
   // Conceptually we need a MEMBAR #storestore|#loadstore barrier or fence immediately
   // before the store that releases the lock.  Crucially, all the stores and loads in the
   // critical section must be globally visible before the store of 0 into the lock-word
@@ -532,9 +532,9 @@
   // safety or lock release consistency.
   OrderAccess::release_store(&_LockWord.Bytes[_LSBINDEX], 0); // drop outer lock
 
-  OrderAccess::storeload ();
-  ParkEvent * const w = _OnDeck ;
-  assert (RelaxAssert || w != Thread::current()->_MutexEvent, "invariant") ;
+  OrderAccess::storeload();
+  ParkEvent * const w = _OnDeck;
+  assert(RelaxAssert || w != Thread::current()->_MutexEvent, "invariant");
   if (w != NULL) {
     // Either we have a valid ondeck thread or ondeck is transiently "locked"
     // by some exiting thread as it arranges for succession.  The LSBit of
@@ -549,19 +549,19 @@
     // then progress is known to have occurred as that means the thread associated
     // with "w" acquired the lock.  In that case this thread need take no further
     // action to guarantee progress.
-    if ((UNS(w) & _LBIT) == 0) w->unpark() ;
-    return ;
+    if ((UNS(w) & _LBIT) == 0) w->unpark();
+    return;
   }
 
-  intptr_t cxq = _LockWord.FullWord ;
+  intptr_t cxq = _LockWord.FullWord;
   if (((cxq & ~_LBIT)|UNS(_EntryList)) == 0) {
-    return ;      // normal fast-path exit - cxq and EntryList both empty
+    return;      // normal fast-path exit - cxq and EntryList both empty
   }
   if (cxq & _LBIT) {
     // Optional optimization ...
     // Some other thread acquired the lock in the window since this
     // thread released it.  Succession is now that thread's responsibility.
-    return ;
+    return;
   }
 
  Succession:
@@ -575,22 +575,22 @@
   // picks a successor and marks that thread as OnDeck.  That successor
   // thread will then clear OnDeck once it eventually acquires the outer lock.
   if (CASPTR (&_OnDeck, NULL, _LBIT) != UNS(NULL)) {
-    return ;
+    return;
   }
 
-  ParkEvent * List = _EntryList ;
+  ParkEvent * List = _EntryList;
   if (List != NULL) {
     // Transfer the head of the EntryList to the OnDeck position.
     // Once OnDeck, a thread stays OnDeck until it acquires the lock.
     // For a given lock there is at most OnDeck thread at any one instant.
    WakeOne:
-    assert (List == _EntryList, "invariant") ;
-    ParkEvent * const w = List ;
-    assert (RelaxAssert || w != Thread::current()->_MutexEvent, "invariant") ;
-    _EntryList = w->ListNext ;
+    assert(List == _EntryList, "invariant");
+    ParkEvent * const w = List;
+    assert(RelaxAssert || w != Thread::current()->_MutexEvent, "invariant");
+    _EntryList = w->ListNext;
     // as a diagnostic measure consider setting w->_ListNext = BAD
-    assert (UNS(_OnDeck) == _LBIT, "invariant") ;
-    _OnDeck = w ;           // pass OnDeck to w.
+    assert(UNS(_OnDeck) == _LBIT, "invariant");
+    _OnDeck = w;           // pass OnDeck to w.
                             // w will clear OnDeck once it acquires the outer lock
 
     // Another optional optimization ...
@@ -599,25 +599,25 @@
     // Try to defer the unpark() operation - Delegate the responsibility
     // for unpark()ing the OnDeck thread to the current or subsequent owners
     // That is, the new owner is responsible for unparking the OnDeck thread.
-    OrderAccess::storeload() ;
-    cxq = _LockWord.FullWord ;
-    if (cxq & _LBIT) return ;
+    OrderAccess::storeload();
+    cxq = _LockWord.FullWord;
+    if (cxq & _LBIT) return;
 
-    w->unpark() ;
-    return ;
+    w->unpark();
+    return;
   }
 
-  cxq = _LockWord.FullWord ;
+  cxq = _LockWord.FullWord;
   if ((cxq & ~_LBIT) != 0) {
     // The EntryList is empty but the cxq is populated.
     // drain RATs from cxq into EntryList
     // Detach RATs segment with CAS and then merge into EntryList
     for (;;) {
       // optional optimization - if locked, the owner is responsible for succession
-      if (cxq & _LBIT) goto Punt ;
-      const intptr_t vfy = CASPTR (&_LockWord, cxq, cxq & _LBIT) ;
-      if (vfy == cxq) break ;
-      cxq = vfy ;
+      if (cxq & _LBIT) goto Punt;
+      const intptr_t vfy = CASPTR(&_LockWord, cxq, cxq & _LBIT);
+      if (vfy == cxq) break;
+      cxq = vfy;
       // Interference - LockWord changed - Just retry
       // We can see concurrent interference from contending threads
       // pushing themselves onto the cxq or from lock-unlock operations.
@@ -639,10 +639,10 @@
     // the EntryList, but it might make sense to reverse the order
     // or perhaps sort by thread priority.  See the comments in
     // synchronizer.cpp objectMonitor::exit().
-    assert (_EntryList == NULL, "invariant") ;
-    _EntryList = List = (ParkEvent *)(cxq & ~_LBIT) ;
-    assert (List != NULL, "invariant") ;
-    goto WakeOne ;
+    assert(_EntryList == NULL, "invariant");
+    _EntryList = List = (ParkEvent *)(cxq & ~_LBIT);
+    assert(List != NULL, "invariant");
+    goto WakeOne;
   }
 
   // cxq|EntryList is empty.
@@ -651,8 +651,8 @@
   // A thread could have added itself to cxq since this thread previously checked.
   // Detect and recover by refetching cxq.
  Punt:
-  assert (UNS(_OnDeck) == _LBIT, "invariant") ;
-  _OnDeck = NULL ;            // Release inner lock.
+  assert(UNS(_OnDeck) == _LBIT, "invariant");
+  _OnDeck = NULL;            // Release inner lock.
   OrderAccess::storeload();   // Dekker duality - pivot point
 
   // Resample LockWord/cxq to recover from possible race.
@@ -665,32 +665,32 @@
   // Note that we don't need to recheck EntryList, just cxq.
   // If threads moved onto EntryList since we dropped OnDeck
   // that implies some other thread forced succession.
-  cxq = _LockWord.FullWord ;
+  cxq = _LockWord.FullWord;
   if ((cxq & ~_LBIT) != 0 && (cxq & _LBIT) == 0) {
-    goto Succession ;         // potential race -- re-run succession
+    goto Succession;         // potential race -- re-run succession
   }
-  return ;
+  return;
 }
 
 bool Monitor::notify() {
-  assert (_owner == Thread::current(), "invariant") ;
-  assert (ILocked(), "invariant") ;
-  if (_WaitSet == NULL) return true ;
-  NotifyCount ++ ;
+  assert(_owner == Thread::current(), "invariant");
+  assert(ILocked(), "invariant");
+  if (_WaitSet == NULL) return true;
+  NotifyCount++;
 
   // Transfer one thread from the WaitSet to the EntryList or cxq.
   // Currently we just unlink the head of the WaitSet and prepend to the cxq.
   // And of course we could just unlink it and unpark it, too, but
   // in that case it'd likely impale itself on the reentry.
-  Thread::muxAcquire (_WaitLock, "notify:WaitLock") ;
-  ParkEvent * nfy = _WaitSet ;
+  Thread::muxAcquire(_WaitLock, "notify:WaitLock");
+  ParkEvent * nfy = _WaitSet;
   if (nfy != NULL) {                  // DCL idiom
-    _WaitSet = nfy->ListNext ;
-    assert (nfy->Notified == 0, "invariant") ;
+    _WaitSet = nfy->ListNext;
+    assert(nfy->Notified == 0, "invariant");
     // push nfy onto the cxq
     for (;;) {
-      const intptr_t v = _LockWord.FullWord ;
-      assert ((v & 0xFF) == _LBIT, "invariant") ;
+      const intptr_t v = _LockWord.FullWord;
+      assert((v & 0xFF) == _LBIT, "invariant");
       nfy->ListNext = (ParkEvent *)(v & ~_LBIT);
       if (CASPTR (&_LockWord, v, UNS(nfy)|_LBIT) == v) break;
       // interference - _LockWord changed -- just retry
@@ -698,17 +698,17 @@
     // Note that setting Notified before pushing nfy onto the cxq is
     // also legal and safe, but the safety properties are much more
     // subtle, so for the sake of code stewardship ...
-    OrderAccess::fence() ;
+    OrderAccess::fence();
     nfy->Notified = 1;
   }
-  Thread::muxRelease (_WaitLock) ;
+  Thread::muxRelease(_WaitLock);
   if (nfy != NULL && (NativeMonitorFlags & 16)) {
     // Experimental code ... light up the wakee in the hope that this thread (the owner)
     // will drop the lock just about the time the wakee comes ONPROC.
-    nfy->unpark() ;
+    nfy->unpark();
   }
-  assert (ILocked(), "invariant") ;
-  return true ;
+  assert(ILocked(), "invariant");
+  return true;
 }
 
 // Currently notifyAll() transfers the waiters one-at-a-time from the waitset
@@ -719,14 +719,14 @@
 // will be empty and the cxq will be "DCBAXYZ".  This is benign, of course.
 
 bool Monitor::notify_all() {
-  assert (_owner == Thread::current(), "invariant") ;
-  assert (ILocked(), "invariant") ;
-  while (_WaitSet != NULL) notify() ;
-  return true ;
+  assert(_owner == Thread::current(), "invariant");
+  assert(ILocked(), "invariant");
+  while (_WaitSet != NULL) notify();
+  return true;
 }
 
 int Monitor::IWait (Thread * Self, jlong timo) {
-  assert (ILocked(), "invariant") ;
+  assert(ILocked(), "invariant");
 
   // Phases:
   // 1. Enqueue Self on WaitSet - currently prepend
@@ -734,10 +734,10 @@
   // 3. wait for either notification or timeout
   // 4. lock - reentry - reacquire the outer lock
 
-  ParkEvent * const ESelf = Self->_MutexEvent ;
-  ESelf->Notified = 0 ;
-  ESelf->reset() ;
-  OrderAccess::fence() ;
+  ParkEvent * const ESelf = Self->_MutexEvent;
+  ESelf->Notified = 0;
+  ESelf->reset();
+  OrderAccess::fence();
 
   // Add Self to WaitSet
   // Ideally only the holder of the outer lock would manipulate the WaitSet -
@@ -766,10 +766,10 @@
   // In that case we could have one ListElement on the WaitSet and another
   // on the EntryList, with both referring to the same pure Event.
 
-  Thread::muxAcquire (_WaitLock, "wait:WaitLock:Add") ;
-  ESelf->ListNext = _WaitSet ;
-  _WaitSet = ESelf ;
-  Thread::muxRelease (_WaitLock) ;
+  Thread::muxAcquire(_WaitLock, "wait:WaitLock:Add");
+  ESelf->ListNext = _WaitSet;
+  _WaitSet = ESelf;
+  Thread::muxRelease(_WaitLock);
 
   // Release the outer lock
   // We call IUnlock (RelaxAssert=true) as a thread T1 might
@@ -781,16 +781,16 @@
   // IUnlock() call a thread should _never find itself on the EntryList
   // or cxq, but in the case of wait() it's possible.
   // See synchronizer.cpp objectMonitor::wait().
-  IUnlock (true) ;
+  IUnlock(true);
 
   // Wait for either notification or timeout
   // Beware that in some circumstances we might propagate
   // spurious wakeups back to the caller.
 
   for (;;) {
-    if (ESelf->Notified) break ;
-    int err = ParkCommon (ESelf, timo) ;
-    if (err == OS_TIMEOUT || (NativeMonitorFlags & 1)) break ;
+    if (ESelf->Notified) break;
+    int err = ParkCommon(ESelf, timo);
+    if (err == OS_TIMEOUT || (NativeMonitorFlags & 1)) break;
   }
 
   // Prepare for reentry - if necessary, remove ESelf from WaitSet
@@ -799,55 +799,55 @@
   // 2. On the cxq or EntryList
   // 3. Not resident on cxq, EntryList or WaitSet, but in the OnDeck position.
 
-  OrderAccess::fence() ;
-  int WasOnWaitSet = 0 ;
+  OrderAccess::fence();
+  int WasOnWaitSet = 0;
   if (ESelf->Notified == 0) {
-    Thread::muxAcquire (_WaitLock, "wait:WaitLock:remove") ;
+    Thread::muxAcquire(_WaitLock, "wait:WaitLock:remove");
     if (ESelf->Notified == 0) {     // DCL idiom
-      assert (_OnDeck != ESelf, "invariant") ;   // can't be both OnDeck and on WaitSet
+      assert(_OnDeck != ESelf, "invariant");   // can't be both OnDeck and on WaitSet
       // ESelf is resident on the WaitSet -- unlink it.
       // A doubly-linked list would be better here so we can unlink in constant-time.
       // We have to unlink before we potentially recontend as ESelf might otherwise
       // end up on the cxq|EntryList -- it can't be on two lists at once.
-      ParkEvent * p = _WaitSet ;
-      ParkEvent * q = NULL ;            // classic q chases p
+      ParkEvent * p = _WaitSet;
+      ParkEvent * q = NULL;            // classic q chases p
       while (p != NULL && p != ESelf) {
-        q = p ;
-        p = p->ListNext ;
+        q = p;
+        p = p->ListNext;
       }
-      assert (p == ESelf, "invariant") ;
+      assert(p == ESelf, "invariant");
       if (p == _WaitSet) {      // found at head
-        assert (q == NULL, "invariant") ;
-        _WaitSet = p->ListNext ;
+        assert(q == NULL, "invariant");
+        _WaitSet = p->ListNext;
       } else {                  // found in interior
-        assert (q->ListNext == p, "invariant") ;
-        q->ListNext = p->ListNext ;
+        assert(q->ListNext == p, "invariant");
+        q->ListNext = p->ListNext;
       }
-      WasOnWaitSet = 1 ;        // We were *not* notified but instead encountered timeout
+      WasOnWaitSet = 1;        // We were *not* notified but instead encountered timeout
     }
-    Thread::muxRelease (_WaitLock) ;
+    Thread::muxRelease(_WaitLock);
   }
 
   // Reentry phase - reacquire the lock
   if (WasOnWaitSet) {
     // ESelf was previously on the WaitSet but we just unlinked it above
     // because of a timeout.  ESelf is not resident on any list and is not OnDeck
-    assert (_OnDeck != ESelf, "invariant") ;
-    ILock (Self) ;
+    assert(_OnDeck != ESelf, "invariant");
+    ILock(Self);
   } else {
     // A prior notify() operation moved ESelf from the WaitSet to the cxq.
     // ESelf is now on the cxq, EntryList or at the OnDeck position.
     // The following fragment is extracted from Monitor::ILock()
     for (;;) {
-      if (_OnDeck == ESelf && TrySpin(Self)) break ;
-      ParkCommon (ESelf, 0) ;
+      if (_OnDeck == ESelf && TrySpin(Self)) break;
+      ParkCommon(ESelf, 0);
     }
-    assert (_OnDeck == ESelf, "invariant") ;
-    _OnDeck = NULL ;
+    assert(_OnDeck == ESelf, "invariant");
+    _OnDeck = NULL;
   }
 
-  assert (ILocked(), "invariant") ;
-  return WasOnWaitSet != 0 ;        // return true IFF timeout
+  assert(ILocked(), "invariant");
+  return WasOnWaitSet != 0;        // return true IFF timeout
 }
 
 
@@ -896,15 +896,15 @@
 #endif // CHECK_UNHANDLED_OOPS
 
   debug_only(check_prelock_state(Self));
-  assert (_owner != Self              , "invariant") ;
-  assert (_OnDeck != Self->_MutexEvent, "invariant") ;
+  assert(_owner != Self              , "invariant");
+  assert(_OnDeck != Self->_MutexEvent, "invariant");
 
   if (TryFast()) {
  Exeunt:
-    assert (ILocked(), "invariant") ;
-    assert (owner() == NULL, "invariant");
-    set_owner (Self);
-    return ;
+    assert(ILocked(), "invariant");
+    assert(owner() == NULL, "invariant");
+    set_owner(Self);
+    return;
   }
 
   // The lock is contended ...
@@ -916,23 +916,23 @@
     // and go on.  we note this with _snuck so we can also
     // pretend to unlock when the time comes.
     _snuck = true;
-    goto Exeunt ;
+    goto Exeunt;
   }
 
   // Try a brief spin to avoid passing thru thread state transition ...
-  if (TrySpin (Self)) goto Exeunt ;
+  if (TrySpin(Self)) goto Exeunt;
 
   check_block_state(Self);
   if (Self->is_Java_thread()) {
     // Horrible dictu - we suffer through a state transition
     assert(rank() > Mutex::special, "Potential deadlock with special or lesser rank mutex");
-    ThreadBlockInVM tbivm ((JavaThread *) Self) ;
-    ILock (Self) ;
+    ThreadBlockInVM tbivm((JavaThread *) Self);
+    ILock(Self);
   } else {
     // Mirabile dictu
-    ILock (Self) ;
+    ILock(Self);
   }
-  goto Exeunt ;
+  goto Exeunt;
 }
 
 void Monitor::lock() {
@@ -945,14 +945,14 @@
 // thread state set to be in VM, the safepoint synchronization code will deadlock!
 
 void Monitor::lock_without_safepoint_check (Thread * Self) {
-  assert (_owner != Self, "invariant") ;
-  ILock (Self) ;
-  assert (_owner == NULL, "invariant");
-  set_owner (Self);
+  assert(_owner != Self, "invariant");
+  ILock(Self);
+  assert(_owner == NULL, "invariant");
+  set_owner(Self);
 }
 
-void Monitor::lock_without_safepoint_check () {
-  lock_without_safepoint_check (Thread::current()) ;
+void Monitor::lock_without_safepoint_check() {
+  lock_without_safepoint_check(Thread::current());
 }
 
 
@@ -976,23 +976,23 @@
 
   if (TryLock()) {
     // We got the lock
-    assert (_owner == NULL, "invariant");
-    set_owner (Self);
+    assert(_owner == NULL, "invariant");
+    set_owner(Self);
     return true;
   }
   return false;
 }
 
 void Monitor::unlock() {
-  assert (_owner  == Thread::current(), "invariant") ;
-  assert (_OnDeck != Thread::current()->_MutexEvent , "invariant") ;
-  set_owner (NULL) ;
+  assert(_owner  == Thread::current(), "invariant");
+  assert(_OnDeck != Thread::current()->_MutexEvent , "invariant");
+  set_owner(NULL);
   if (_snuck) {
     assert(SafepointSynchronize::is_at_safepoint() && Thread::current()->is_VM_thread(), "sneak");
     _snuck = false;
-    return ;
+    return;
   }
-  IUnlock (false) ;
+  IUnlock(false);
 }
 
 // Yet another degenerate version of Monitor::lock() or lock_without_safepoint_check()
@@ -1020,29 +1020,29 @@
 
   if (TryLock()) {
  Exeunt:
-    assert (ILocked(), "invariant") ;
-    assert (_owner == NULL, "invariant");
+    assert(ILocked(), "invariant");
+    assert(_owner == NULL, "invariant");
     // This can potentially be called by non-java Threads. Thus, the ThreadLocalStorage
     // might return NULL. Don't call set_owner since it will break on an NULL owner
     // Consider installing a non-null "ANON" distinguished value instead of just NULL.
     _owner = ThreadLocalStorage::thread();
-    return ;
+    return;
   }
 
-  if (TrySpin(NULL)) goto Exeunt ;
+  if (TrySpin(NULL)) goto Exeunt;
 
   // slow-path - apparent contention
   // Allocate a ParkEvent for transient use.
   // The ParkEvent remains associated with this thread until
   // the time the thread manages to acquire the lock.
-  ParkEvent * const ESelf = ParkEvent::Allocate(NULL) ;
-  ESelf->reset() ;
-  OrderAccess::storeload() ;
+  ParkEvent * const ESelf = ParkEvent::Allocate(NULL);
+  ESelf->reset();
+  OrderAccess::storeload();
 
   // Either Enqueue Self on cxq or acquire the outer lock.
   if (AcquireOrPush (ESelf)) {
-    ParkEvent::Release (ESelf) ;      // surrender the ParkEvent
-    goto Exeunt ;
+    ParkEvent::Release(ESelf);      // surrender the ParkEvent
+    goto Exeunt;
   }
 
   // At any given time there is at most one ondeck thread.
@@ -1050,37 +1050,37 @@
   // Only the OnDeck thread can try to acquire -- contended for -- the lock.
   // CONSIDER: use Self->OnDeck instead of m->OnDeck.
   for (;;) {
-    if (_OnDeck == ESelf && TrySpin(NULL)) break ;
-    ParkCommon (ESelf, 0) ;
+    if (_OnDeck == ESelf && TrySpin(NULL)) break;
+    ParkCommon(ESelf, 0);
   }
 
-  assert (_OnDeck == ESelf, "invariant") ;
-  _OnDeck = NULL ;
-  ParkEvent::Release (ESelf) ;      // surrender the ParkEvent
-  goto Exeunt ;
+  assert(_OnDeck == ESelf, "invariant");
+  _OnDeck = NULL;
+  ParkEvent::Release(ESelf);      // surrender the ParkEvent
+  goto Exeunt;
 }
 
 void Monitor::jvm_raw_unlock() {
   // Nearly the same as Monitor::unlock() ...
   // directly set _owner instead of using set_owner(null)
-  _owner = NULL ;
+  _owner = NULL;
   if (_snuck) {         // ???
     assert(SafepointSynchronize::is_at_safepoint() && Thread::current()->is_VM_thread(), "sneak");
     _snuck = false;
-    return ;
+    return;
   }
-  IUnlock(false) ;
+  IUnlock(false);
 }
 
 bool Monitor::wait(bool no_safepoint_check, long timeout, bool as_suspend_equivalent) {
-  Thread * const Self = Thread::current() ;
-  assert (_owner == Self, "invariant") ;
-  assert (ILocked(), "invariant") ;
+  Thread * const Self = Thread::current();
+  assert(_owner == Self, "invariant");
+  assert(ILocked(), "invariant");
 
   // as_suspend_equivalent logically implies !no_safepoint_check
-  guarantee (!as_suspend_equivalent || !no_safepoint_check, "invariant") ;
+  guarantee(!as_suspend_equivalent || !no_safepoint_check, "invariant");
   // !no_safepoint_check logically implies java_thread
-  guarantee (no_safepoint_check || Self->is_Java_thread(), "invariant") ;
+  guarantee(no_safepoint_check || Self->is_Java_thread(), "invariant");
 
   #ifdef ASSERT
     Monitor * least = get_least_ranked_lock_besides_this(Self->owned_locks());
@@ -1093,14 +1093,14 @@
     }
   #endif // ASSERT
 
-  int wait_status ;
+  int wait_status;
   // conceptually set the owner to NULL in anticipation of
   // abdicating the lock in wait
   set_owner(NULL);
   if (no_safepoint_check) {
-    wait_status = IWait (Self, timeout) ;
+    wait_status = IWait(Self, timeout);
   } else {
-    assert (Self->is_Java_thread(), "invariant") ;
+    assert(Self->is_Java_thread(), "invariant");
     JavaThread *jt = (JavaThread *)Self;
 
     // Enter safepoint region - ornate and Rococo ...
@@ -1113,7 +1113,7 @@
       // java_suspend_self()
     }
 
-    wait_status = IWait (Self, timeout) ;
+    wait_status = IWait(Self, timeout);
 
     // were we externally suspended while we were waiting?
     if (as_suspend_equivalent && jt->handle_special_suspend_equivalent_condition()) {
@@ -1121,67 +1121,67 @@
       // while we were waiting another thread suspended us. We don't
       // want to hold the lock while suspended because that
       // would surprise the thread that suspended us.
-      assert (ILocked(), "invariant") ;
-      IUnlock (true) ;
+      assert(ILocked(), "invariant");
+      IUnlock(true);
       jt->java_suspend_self();
-      ILock (Self) ;
-      assert (ILocked(), "invariant") ;
+      ILock(Self);
+      assert(ILocked(), "invariant");
     }
   }
 
   // Conceptually reestablish ownership of the lock.
   // The "real" lock -- the LockByte -- was reacquired by IWait().
-  assert (ILocked(), "invariant") ;
-  assert (_owner == NULL, "invariant") ;
-  set_owner (Self) ;
-  return wait_status != 0 ;          // return true IFF timeout
+  assert(ILocked(), "invariant");
+  assert(_owner == NULL, "invariant");
+  set_owner(Self);
+  return wait_status != 0;          // return true IFF timeout
 }
 
 Monitor::~Monitor() {
-  assert ((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "") ;
+  assert((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "");
 }
 
 void Monitor::ClearMonitor (Monitor * m, const char *name) {
-  m->_owner             = NULL ;
-  m->_snuck             = false ;
+  m->_owner             = NULL;
+  m->_snuck             = false;
   if (name == NULL) {
-    strcpy(m->_name, "UNKNOWN") ;
+    strcpy(m->_name, "UNKNOWN");
   } else {
     strncpy(m->_name, name, MONITOR_NAME_LEN - 1);
     m->_name[MONITOR_NAME_LEN - 1] = '\0';
   }
-  m->_LockWord.FullWord = 0 ;
-  m->_EntryList         = NULL ;
-  m->_OnDeck            = NULL ;
-  m->_WaitSet           = NULL ;
-  m->_WaitLock[0]       = 0 ;
+  m->_LockWord.FullWord = 0;
+  m->_EntryList         = NULL;
+  m->_OnDeck            = NULL;
+  m->_WaitSet           = NULL;
+  m->_WaitLock[0]       = 0;
 }
 
 Monitor::Monitor() { ClearMonitor(this); }
 
 Monitor::Monitor (int Rank, const char * name, bool allow_vm_block) {
-  ClearMonitor (this, name) ;
+  ClearMonitor(this, name);
 #ifdef ASSERT
   _allow_vm_block  = allow_vm_block;
-  _rank            = Rank ;
+  _rank            = Rank;
 #endif
 }
 
 Mutex::~Mutex() {
-  assert ((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "") ;
+  assert((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "");
 }
 
 Mutex::Mutex (int Rank, const char * name, bool allow_vm_block) {
-  ClearMonitor ((Monitor *) this, name) ;
+  ClearMonitor((Monitor *) this, name);
 #ifdef ASSERT
  _allow_vm_block   = allow_vm_block;
- _rank             = Rank ;
+ _rank             = Rank;
 #endif
 }
 
 bool Monitor::owned_by_self() const {
   bool ret = _owner == Thread::current();
-  assert (!ret || _LockWord.Bytes[_LSBINDEX] != 0, "invariant") ;
+  assert(!ret || _LockWord.Bytes[_LSBINDEX] != 0, "invariant");
   return ret;
 }
 
--- a/hotspot/src/share/vm/runtime/objectMonitor.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -114,38 +114,38 @@
 // The knob* variables are effectively final.  Once set they should
 // never be modified hence.  Consider using __read_mostly with GCC.
 
-int ObjectMonitor::Knob_Verbose    = 0 ;
-int ObjectMonitor::Knob_SpinLimit  = 5000 ;    // derived by an external tool -
-static int Knob_LogSpins           = 0 ;       // enable jvmstat tally for spins
-static int Knob_HandOff            = 0 ;
-static int Knob_ReportSettings     = 0 ;
+int ObjectMonitor::Knob_Verbose    = 0;
+int ObjectMonitor::Knob_SpinLimit  = 5000;    // derived by an external tool -
+static int Knob_LogSpins           = 0;       // enable jvmstat tally for spins
+static int Knob_HandOff            = 0;
+static int Knob_ReportSettings     = 0;
 
-static int Knob_SpinBase           = 0 ;       // Floor AKA SpinMin
-static int Knob_SpinBackOff        = 0 ;       // spin-loop backoff
-static int Knob_CASPenalty         = -1 ;      // Penalty for failed CAS
-static int Knob_OXPenalty          = -1 ;      // Penalty for observed _owner change
-static int Knob_SpinSetSucc        = 1 ;       // spinners set the _succ field
-static int Knob_SpinEarly          = 1 ;
-static int Knob_SuccEnabled        = 1 ;       // futile wake throttling
-static int Knob_SuccRestrict       = 0 ;       // Limit successors + spinners to at-most-one
-static int Knob_MaxSpinners        = -1 ;      // Should be a function of # CPUs
-static int Knob_Bonus              = 100 ;     // spin success bonus
-static int Knob_BonusB             = 100 ;     // spin success bonus
-static int Knob_Penalty            = 200 ;     // spin failure penalty
-static int Knob_Poverty            = 1000 ;
-static int Knob_SpinAfterFutile    = 1 ;       // Spin after returning from park()
-static int Knob_FixedSpin          = 0 ;
-static int Knob_OState             = 3 ;       // Spinner checks thread state of _owner
-static int Knob_UsePause           = 1 ;
-static int Knob_ExitPolicy         = 0 ;
-static int Knob_PreSpin            = 10 ;      // 20-100 likely better
-static int Knob_ResetEvent         = 0 ;
-static int BackOffMask             = 0 ;
+static int Knob_SpinBase           = 0;       // Floor AKA SpinMin
+static int Knob_SpinBackOff        = 0;       // spin-loop backoff
+static int Knob_CASPenalty         = -1;      // Penalty for failed CAS
+static int Knob_OXPenalty          = -1;      // Penalty for observed _owner change
+static int Knob_SpinSetSucc        = 1;       // spinners set the _succ field
+static int Knob_SpinEarly          = 1;
+static int Knob_SuccEnabled        = 1;       // futile wake throttling
+static int Knob_SuccRestrict       = 0;       // Limit successors + spinners to at-most-one
+static int Knob_MaxSpinners        = -1;      // Should be a function of # CPUs
+static int Knob_Bonus              = 100;     // spin success bonus
+static int Knob_BonusB             = 100;     // spin success bonus
+static int Knob_Penalty            = 200;     // spin failure penalty
+static int Knob_Poverty            = 1000;
+static int Knob_SpinAfterFutile    = 1;       // Spin after returning from park()
+static int Knob_FixedSpin          = 0;
+static int Knob_OState             = 3;       // Spinner checks thread state of _owner
+static int Knob_UsePause           = 1;
+static int Knob_ExitPolicy         = 0;
+static int Knob_PreSpin            = 10;      // 20-100 likely better
+static int Knob_ResetEvent         = 0;
+static int BackOffMask             = 0;
 
-static int Knob_FastHSSEC          = 0 ;
-static int Knob_MoveNotifyee       = 2 ;       // notify() - disposition of notifyee
-static int Knob_QMode              = 0 ;       // EntryList-cxq policy - queue discipline
-static volatile int InitDone       = 0 ;
+static int Knob_FastHSSEC          = 0;
+static int Knob_MoveNotifyee       = 2;       // notify() - disposition of notifyee
+static int Knob_QMode              = 0;       // EntryList-cxq policy - queue discipline
+static volatile int InitDone       = 0;
 
 #define TrySpin TrySpin_VaryDuration
 
@@ -265,9 +265,9 @@
   if (THREAD != _owner) {
     if (THREAD->is_lock_owned ((address)_owner)) {
        assert(_recursions == 0, "internal state error");
-       _owner = THREAD ;
-       _recursions = 1 ;
-       OwnerIsThread = 1 ;
+       _owner = THREAD;
+       _recursions = 1;
+       OwnerIsThread = 1;
        return true;
     }
     if (Atomic::cmpxchg_ptr (THREAD, &_owner, NULL) != NULL) {
@@ -283,37 +283,37 @@
 void ATTR ObjectMonitor::enter(TRAPS) {
   // The following code is ordered to check the most common cases first
   // and to reduce RTS->RTO cache line upgrades on SPARC and IA32 processors.
-  Thread * const Self = THREAD ;
-  void * cur ;
+  Thread * const Self = THREAD;
+  void * cur;
 
-  cur = Atomic::cmpxchg_ptr (Self, &_owner, NULL) ;
+  cur = Atomic::cmpxchg_ptr(Self, &_owner, NULL);
   if (cur == NULL) {
      // Either ASSERT _recursions == 0 or explicitly set _recursions = 0.
-     assert (_recursions == 0   , "invariant") ;
-     assert (_owner      == Self, "invariant") ;
+     assert(_recursions == 0   , "invariant");
+     assert(_owner      == Self, "invariant");
      // CONSIDER: set or assert OwnerIsThread == 1
-     return ;
+     return;
   }
 
   if (cur == Self) {
      // TODO-FIXME: check for integer overflow!  BUGID 6557169.
-     _recursions ++ ;
-     return ;
+     _recursions++;
+     return;
   }
 
   if (Self->is_lock_owned ((address)cur)) {
-    assert (_recursions == 0, "internal state error");
-    _recursions = 1 ;
+    assert(_recursions == 0, "internal state error");
+    _recursions = 1;
     // Commute owner from a thread-specific on-stack BasicLockObject address to
     // a full-fledged "Thread *".
-    _owner = Self ;
-    OwnerIsThread = 1 ;
-    return ;
+    _owner = Self;
+    OwnerIsThread = 1;
+    return;
   }
 
   // We've encountered genuine contention.
-  assert (Self->_Stalled == 0, "invariant") ;
-  Self->_Stalled = intptr_t(this) ;
+  assert(Self->_Stalled == 0, "invariant");
+  Self->_Stalled = intptr_t(this);
 
   // Try one round of spinning *before* enqueueing Self
   // and before going through the awkward and expensive state
@@ -321,21 +321,21 @@
   // Note that if we acquire the monitor from an initial spin
   // we forgo posting JVMTI events and firing DTRACE probes.
   if (Knob_SpinEarly && TrySpin (Self) > 0) {
-     assert (_owner == Self      , "invariant") ;
-     assert (_recursions == 0    , "invariant") ;
-     assert (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ;
-     Self->_Stalled = 0 ;
-     return ;
+     assert(_owner == Self      , "invariant");
+     assert(_recursions == 0    , "invariant");
+     assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant");
+     Self->_Stalled = 0;
+     return;
   }
 
-  assert (_owner != Self          , "invariant") ;
-  assert (_succ  != Self          , "invariant") ;
-  assert (Self->is_Java_thread()  , "invariant") ;
-  JavaThread * jt = (JavaThread *) Self ;
-  assert (!SafepointSynchronize::is_at_safepoint(), "invariant") ;
-  assert (jt->thread_state() != _thread_blocked   , "invariant") ;
-  assert (this->object() != NULL  , "invariant") ;
-  assert (_count >= 0, "invariant") ;
+  assert(_owner != Self          , "invariant");
+  assert(_succ  != Self          , "invariant");
+  assert(Self->is_Java_thread()  , "invariant");
+  JavaThread * jt = (JavaThread *) Self;
+  assert(!SafepointSynchronize::is_at_safepoint(), "invariant");
+  assert(jt->thread_state() != _thread_blocked   , "invariant");
+  assert(this->object() != NULL  , "invariant");
+  assert(_count >= 0, "invariant");
 
   // Prevent deflation at STW-time.  See deflate_idle_monitors() and is_busy().
   // Ensure the object-monitor relationship remains stable while there's contention.
@@ -368,9 +368,9 @@
       // cleared by handle_special_suspend_equivalent_condition()
       // or java_suspend_self()
 
-      EnterI (THREAD) ;
+      EnterI(THREAD);
 
-      if (!ExitSuspendEquivalent(jt)) break ;
+      if (!ExitSuspendEquivalent(jt)) break;
 
       //
       // We have acquired the contended monitor, but while we were
@@ -378,9 +378,9 @@
       // the monitor while suspended because that would surprise the
       // thread that suspended us.
       //
-          _recursions = 0 ;
-      _succ = NULL ;
-      exit (false, Self) ;
+          _recursions = 0;
+      _succ = NULL;
+      exit(false, Self);
 
       jt->java_suspend_self();
     }
@@ -397,14 +397,14 @@
   }
 
   Atomic::dec_ptr(&_count);
-  assert (_count >= 0, "invariant") ;
-  Self->_Stalled = 0 ;
+  assert(_count >= 0, "invariant");
+  Self->_Stalled = 0;
 
   // Must either set _recursions = 0 or ASSERT _recursions == 0.
-  assert (_recursions == 0     , "invariant") ;
-  assert (_owner == Self       , "invariant") ;
-  assert (_succ  != Self       , "invariant") ;
-  assert (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ;
+  assert(_recursions == 0     , "invariant");
+  assert(_owner == Self       , "invariant");
+  assert(_succ  != Self       , "invariant");
+  assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant");
 
   // The thread -- now the owner -- is back in vm mode.
   // Report the glorious news via TI,DTrace and jvmstat.
@@ -437,7 +437,7 @@
   }
 
   if (ObjectMonitor::_sync_ContendedLockAttempts != NULL) {
-     ObjectMonitor::_sync_ContendedLockAttempts->inc() ;
+     ObjectMonitor::_sync_ContendedLockAttempts->inc();
   }
 }
 
@@ -447,37 +447,37 @@
 
 int ObjectMonitor::TryLock (Thread * Self) {
    for (;;) {
-      void * own = _owner ;
-      if (own != NULL) return 0 ;
+      void * own = _owner;
+      if (own != NULL) return 0;
       if (Atomic::cmpxchg_ptr (Self, &_owner, NULL) == NULL) {
          // Either guarantee _recursions == 0 or set _recursions = 0.
-         assert (_recursions == 0, "invariant") ;
-         assert (_owner == Self, "invariant") ;
+         assert(_recursions == 0, "invariant");
+         assert(_owner == Self, "invariant");
          // CONSIDER: set or assert that OwnerIsThread == 1
-         return 1 ;
+         return 1;
       }
       // The lock had been free momentarily, but we lost the race to the lock.
       // Interference -- the CAS failed.
       // We can either return -1 or retry.
       // Retry doesn't make as much sense because the lock was just acquired.
-      if (true) return -1 ;
+      if (true) return -1;
    }
 }
 
 void ATTR ObjectMonitor::EnterI (TRAPS) {
-    Thread * Self = THREAD ;
-    assert (Self->is_Java_thread(), "invariant") ;
-    assert (((JavaThread *) Self)->thread_state() == _thread_blocked   , "invariant") ;
+    Thread * Self = THREAD;
+    assert(Self->is_Java_thread(), "invariant");
+    assert(((JavaThread *) Self)->thread_state() == _thread_blocked   , "invariant");
 
     // Try the lock - TATAS
     if (TryLock (Self) > 0) {
-        assert (_succ != Self              , "invariant") ;
-        assert (_owner == Self             , "invariant") ;
-        assert (_Responsible != Self       , "invariant") ;
-        return ;
+        assert(_succ != Self              , "invariant");
+        assert(_owner == Self             , "invariant");
+        assert(_Responsible != Self       , "invariant");
+        return;
     }
 
-    DeferredInitialize () ;
+    DeferredInitialize();
 
     // We try one round of spinning *before* enqueueing Self.
     //
@@ -487,16 +487,16 @@
     // effects.
 
     if (TrySpin (Self) > 0) {
-        assert (_owner == Self        , "invariant") ;
-        assert (_succ != Self         , "invariant") ;
-        assert (_Responsible != Self  , "invariant") ;
-        return ;
+        assert(_owner == Self        , "invariant");
+        assert(_succ != Self         , "invariant");
+        assert(_Responsible != Self  , "invariant");
+        return;
     }
 
     // The Spin failed -- Enqueue and park the thread ...
-    assert (_succ  != Self            , "invariant") ;
-    assert (_owner != Self            , "invariant") ;
-    assert (_Responsible != Self      , "invariant") ;
+    assert(_succ  != Self            , "invariant");
+    assert(_owner != Self            , "invariant");
+    assert(_Responsible != Self      , "invariant");
 
     // Enqueue "Self" on ObjectMonitor's _cxq.
     //
@@ -508,27 +508,27 @@
     // TODO: eliminate ObjectWaiter and enqueue either Threads or Events.
     //
 
-    ObjectWaiter node(Self) ;
-    Self->_ParkEvent->reset() ;
-    node._prev   = (ObjectWaiter *) 0xBAD ;
-    node.TState  = ObjectWaiter::TS_CXQ ;
+    ObjectWaiter node(Self);
+    Self->_ParkEvent->reset();
+    node._prev   = (ObjectWaiter *) 0xBAD;
+    node.TState  = ObjectWaiter::TS_CXQ;
 
     // Push "Self" onto the front of the _cxq.
     // Once on cxq/EntryList, Self stays on-queue until it acquires the lock.
     // Note that spinning tends to reduce the rate at which threads
     // enqueue and dequeue on EntryList|cxq.
-    ObjectWaiter * nxt ;
+    ObjectWaiter * nxt;
     for (;;) {
-        node._next = nxt = _cxq ;
-        if (Atomic::cmpxchg_ptr (&node, &_cxq, nxt) == nxt) break ;
+        node._next = nxt = _cxq;
+        if (Atomic::cmpxchg_ptr(&node, &_cxq, nxt) == nxt) break;
 
         // Interference - the CAS failed because _cxq changed.  Just retry.
         // As an optional optimization we retry the lock.
         if (TryLock (Self) > 0) {
-            assert (_succ != Self         , "invariant") ;
-            assert (_owner == Self        , "invariant") ;
-            assert (_Responsible != Self  , "invariant") ;
-            return ;
+            assert(_succ != Self         , "invariant");
+            assert(_owner == Self        , "invariant");
+            assert(_Responsible != Self  , "invariant");
+            return;
         }
     }
 
@@ -558,7 +558,7 @@
     if ((SyncFlags & 16) == 0 && nxt == NULL && _EntryList == NULL) {
         // Try to assume the role of responsible thread for the monitor.
         // CONSIDER:  ST vs CAS vs { if (Responsible==null) Responsible=Self }
-        Atomic::cmpxchg_ptr (Self, &_Responsible, NULL) ;
+        Atomic::cmpxchg_ptr(Self, &_Responsible, NULL);
     }
 
     // The lock have been released while this thread was occupied queueing
@@ -572,49 +572,49 @@
     // to defer the state transitions until absolutely necessary,
     // and in doing so avoid some transitions ...
 
-    TEVENT (Inflated enter - Contention) ;
-    int nWakeups = 0 ;
-    int RecheckInterval = 1 ;
+    TEVENT(Inflated enter - Contention);
+    int nWakeups = 0;
+    int RecheckInterval = 1;
 
     for (;;) {
 
-        if (TryLock (Self) > 0) break ;
-        assert (_owner != Self, "invariant") ;
+        if (TryLock(Self) > 0) break;
+        assert(_owner != Self, "invariant");
 
         if ((SyncFlags & 2) && _Responsible == NULL) {
-           Atomic::cmpxchg_ptr (Self, &_Responsible, NULL) ;
+           Atomic::cmpxchg_ptr(Self, &_Responsible, NULL);
         }
 
         // park self
         if (_Responsible == Self || (SyncFlags & 1)) {
-            TEVENT (Inflated enter - park TIMED) ;
-            Self->_ParkEvent->park ((jlong) RecheckInterval) ;
+            TEVENT(Inflated enter - park TIMED);
+            Self->_ParkEvent->park((jlong) RecheckInterval);
             // Increase the RecheckInterval, but clamp the value.
-            RecheckInterval *= 8 ;
-            if (RecheckInterval > 1000) RecheckInterval = 1000 ;
+            RecheckInterval *= 8;
+            if (RecheckInterval > 1000) RecheckInterval = 1000;
         } else {
-            TEVENT (Inflated enter - park UNTIMED) ;
-            Self->_ParkEvent->park() ;
+            TEVENT(Inflated enter - park UNTIMED);
+            Self->_ParkEvent->park();
         }
 
-        if (TryLock(Self) > 0) break ;
+        if (TryLock(Self) > 0) break;
 
         // The lock is still contested.
         // Keep a tally of the # of futile wakeups.
         // Note that the counter is not protected by a lock or updated by atomics.
         // That is by design - we trade "lossy" counters which are exposed to
         // races during updates for a lower probe effect.
-        TEVENT (Inflated enter - Futile wakeup) ;
+        TEVENT(Inflated enter - Futile wakeup);
         if (ObjectMonitor::_sync_FutileWakeups != NULL) {
-           ObjectMonitor::_sync_FutileWakeups->inc() ;
+           ObjectMonitor::_sync_FutileWakeups->inc();
         }
-        ++ nWakeups ;
+        ++nWakeups;
 
         // Assuming this is not a spurious wakeup we'll normally find _succ == Self.
         // We can defer clearing _succ until after the spin completes
         // TrySpin() must tolerate being called with _succ == Self.
         // Try yet another round of adaptive spinning.
-        if ((Knob_SpinAfterFutile & 1) && TrySpin (Self) > 0) break ;
+        if ((Knob_SpinAfterFutile & 1) && TrySpin(Self) > 0) break;
 
         // We can find that we were unpark()ed and redesignated _succ while
         // we were spinning.  That's harmless.  If we iterate and call park(),
@@ -625,13 +625,13 @@
         // in the next iteration.
 
         if ((Knob_ResetEvent & 1) && Self->_ParkEvent->fired()) {
-           Self->_ParkEvent->reset() ;
-           OrderAccess::fence() ;
+           Self->_ParkEvent->reset();
+           OrderAccess::fence();
         }
-        if (_succ == Self) _succ = NULL ;
+        if (_succ == Self) _succ = NULL;
 
         // Invariant: after clearing _succ a thread *must* retry _owner before parking.
-        OrderAccess::fence() ;
+        OrderAccess::fence();
     }
 
     // Egress :
@@ -642,18 +642,18 @@
     // The head of cxq is volatile but the interior is stable.
     // In addition, Self.TState is stable.
 
-    assert (_owner == Self      , "invariant") ;
-    assert (object() != NULL    , "invariant") ;
+    assert(_owner == Self      , "invariant");
+    assert(object() != NULL    , "invariant");
     // I'd like to write:
     //   guarantee (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ;
     // but as we're at a safepoint that's not safe.
 
-    UnlinkAfterAcquire (Self, &node) ;
-    if (_succ == Self) _succ = NULL ;
+    UnlinkAfterAcquire(Self, &node);
+    if (_succ == Self) _succ = NULL;
 
-    assert (_succ != Self, "invariant") ;
+    assert(_succ != Self, "invariant");
     if (_Responsible == Self) {
-        _Responsible = NULL ;
+        _Responsible = NULL;
         OrderAccess::fence(); // Dekker pivot-point
 
         // We may leave threads on cxq|EntryList without a designated
@@ -700,9 +700,9 @@
     // execute a serializing instruction.
 
     if (SyncFlags & 8) {
-       OrderAccess::fence() ;
+       OrderAccess::fence();
     }
-    return ;
+    return;
 }
 
 // ReenterI() is a specialized inline form of the latter half of the
@@ -714,24 +714,24 @@
 // loop accordingly.
 
 void ATTR ObjectMonitor::ReenterI (Thread * Self, ObjectWaiter * SelfNode) {
-    assert (Self != NULL                , "invariant") ;
-    assert (SelfNode != NULL            , "invariant") ;
-    assert (SelfNode->_thread == Self   , "invariant") ;
-    assert (_waiters > 0                , "invariant") ;
-    assert (((oop)(object()))->mark() == markOopDesc::encode(this) , "invariant") ;
-    assert (((JavaThread *)Self)->thread_state() != _thread_blocked, "invariant") ;
-    JavaThread * jt = (JavaThread *) Self ;
+    assert(Self != NULL                , "invariant");
+    assert(SelfNode != NULL            , "invariant");
+    assert(SelfNode->_thread == Self   , "invariant");
+    assert(_waiters > 0                , "invariant");
+    assert(((oop)(object()))->mark() == markOopDesc::encode(this) , "invariant");
+    assert(((JavaThread *)Self)->thread_state() != _thread_blocked, "invariant");
+    JavaThread * jt = (JavaThread *) Self;
 
-    int nWakeups = 0 ;
+    int nWakeups = 0;
     for (;;) {
-        ObjectWaiter::TStates v = SelfNode->TState ;
-        guarantee (v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant") ;
-        assert    (_owner != Self, "invariant") ;
+        ObjectWaiter::TStates v = SelfNode->TState;
+        guarantee(v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant");
+        assert(_owner != Self, "invariant");
 
-        if (TryLock (Self) > 0) break ;
-        if (TrySpin (Self) > 0) break ;
+        if (TryLock(Self) > 0) break;
+        if (TrySpin(Self) > 0) break;
 
-        TEVENT (Wait Reentry - parking) ;
+        TEVENT(Wait Reentry - parking);
 
         // State transition wrappers around park() ...
         // ReenterI() wisely defers state transitions until
@@ -744,14 +744,14 @@
            // or java_suspend_self()
            jt->set_suspend_equivalent();
            if (SyncFlags & 1) {
-              Self->_ParkEvent->park ((jlong)1000) ;
+              Self->_ParkEvent->park((jlong)1000);
            } else {
-              Self->_ParkEvent->park () ;
+              Self->_ParkEvent->park();
            }
 
            // were we externally suspended while we were waiting?
            for (;;) {
-              if (!ExitSuspendEquivalent (jt)) break ;
+              if (!ExitSuspendEquivalent(jt)) break;
               if (_succ == Self) { _succ = NULL; OrderAccess::fence(); }
               jt->java_suspend_self();
               jt->set_suspend_equivalent();
@@ -761,26 +761,26 @@
         // Try again, but just so we distinguish between futile wakeups and
         // successful wakeups.  The following test isn't algorithmically
         // necessary, but it helps us maintain sensible statistics.
-        if (TryLock(Self) > 0) break ;
+        if (TryLock(Self) > 0) break;
 
         // The lock is still contested.
         // Keep a tally of the # of futile wakeups.
         // Note that the counter is not protected by a lock or updated by atomics.
         // That is by design - we trade "lossy" counters which are exposed to
         // races during updates for a lower probe effect.
-        TEVENT (Wait Reentry - futile wakeup) ;
-        ++ nWakeups ;
+        TEVENT(Wait Reentry - futile wakeup);
+        ++nWakeups;
 
         // Assuming this is not a spurious wakeup we'll normally
         // find that _succ == Self.
-        if (_succ == Self) _succ = NULL ;
+        if (_succ == Self) _succ = NULL;
 
         // Invariant: after clearing _succ a contending thread
         // *must* retry  _owner before parking.
-        OrderAccess::fence() ;
+        OrderAccess::fence();
 
         if (ObjectMonitor::_sync_FutileWakeups != NULL) {
-          ObjectMonitor::_sync_FutileWakeups->inc() ;
+          ObjectMonitor::_sync_FutileWakeups->inc();
         }
     }
 
@@ -792,13 +792,13 @@
     // The head of cxq is volatile but the interior is stable.
     // In addition, Self.TState is stable.
 
-    assert (_owner == Self, "invariant") ;
-    assert (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ;
-    UnlinkAfterAcquire (Self, SelfNode) ;
-    if (_succ == Self) _succ = NULL ;
-    assert (_succ != Self, "invariant") ;
-    SelfNode->TState = ObjectWaiter::TS_RUN ;
-    OrderAccess::fence() ;      // see comments at the end of EnterI()
+    assert(_owner == Self, "invariant");
+    assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant");
+    UnlinkAfterAcquire(Self, SelfNode);
+    if (_succ == Self) _succ = NULL;
+    assert(_succ != Self, "invariant");
+    SelfNode->TState = ObjectWaiter::TS_RUN;
+    OrderAccess::fence();      // see comments at the end of EnterI()
 }
 
 // after the thread acquires the lock in ::enter().  Equally, we could defer
@@ -806,22 +806,22 @@
 
 void ObjectMonitor::UnlinkAfterAcquire (Thread * Self, ObjectWaiter * SelfNode)
 {
-    assert (_owner == Self, "invariant") ;
-    assert (SelfNode->_thread == Self, "invariant") ;
+    assert(_owner == Self, "invariant");
+    assert(SelfNode->_thread == Self, "invariant");
 
     if (SelfNode->TState == ObjectWaiter::TS_ENTER) {
         // Normal case: remove Self from the DLL EntryList .
         // This is a constant-time operation.
-        ObjectWaiter * nxt = SelfNode->_next ;
-        ObjectWaiter * prv = SelfNode->_prev ;
-        if (nxt != NULL) nxt->_prev = prv ;
-        if (prv != NULL) prv->_next = nxt ;
-        if (SelfNode == _EntryList ) _EntryList = nxt ;
-        assert (nxt == NULL || nxt->TState == ObjectWaiter::TS_ENTER, "invariant") ;
-        assert (prv == NULL || prv->TState == ObjectWaiter::TS_ENTER, "invariant") ;
-        TEVENT (Unlink from EntryList) ;
+        ObjectWaiter * nxt = SelfNode->_next;
+        ObjectWaiter * prv = SelfNode->_prev;
+        if (nxt != NULL) nxt->_prev = prv;
+        if (prv != NULL) prv->_next = nxt;
+        if (SelfNode == _EntryList) _EntryList = nxt;
+        assert(nxt == NULL || nxt->TState == ObjectWaiter::TS_ENTER, "invariant");
+        assert(prv == NULL || prv->TState == ObjectWaiter::TS_ENTER, "invariant");
+        TEVENT(Unlink from EntryList);
     } else {
-        guarantee (SelfNode->TState == ObjectWaiter::TS_CXQ, "invariant") ;
+        guarantee(SelfNode->TState == ObjectWaiter::TS_CXQ, "invariant");
         // Inopportune interleaving -- Self is still on the cxq.
         // This usually means the enqueue of self raced an exiting thread.
         // Normally we'll find Self near the front of the cxq, so
@@ -835,36 +835,36 @@
         // and then unlink Self from EntryList.  We have to drain eventually,
         // so it might as well be now.
 
-        ObjectWaiter * v = _cxq ;
-        assert (v != NULL, "invariant") ;
+        ObjectWaiter * v = _cxq;
+        assert(v != NULL, "invariant");
         if (v != SelfNode || Atomic::cmpxchg_ptr (SelfNode->_next, &_cxq, v) != v) {
             // The CAS above can fail from interference IFF a "RAT" arrived.
             // In that case Self must be in the interior and can no longer be
             // at the head of cxq.
             if (v == SelfNode) {
-                assert (_cxq != v, "invariant") ;
-                v = _cxq ;          // CAS above failed - start scan at head of list
+                assert(_cxq != v, "invariant");
+                v = _cxq;          // CAS above failed - start scan at head of list
             }
-            ObjectWaiter * p ;
-            ObjectWaiter * q = NULL ;
-            for (p = v ; p != NULL && p != SelfNode; p = p->_next) {
-                q = p ;
-                assert (p->TState == ObjectWaiter::TS_CXQ, "invariant") ;
+            ObjectWaiter * p;
+            ObjectWaiter * q = NULL;
+            for (p = v; p != NULL && p != SelfNode; p = p->_next) {
+                q = p;
+                assert(p->TState == ObjectWaiter::TS_CXQ, "invariant");
             }
-            assert (v != SelfNode,  "invariant") ;
-            assert (p == SelfNode,  "Node not found on cxq") ;
-            assert (p != _cxq,      "invariant") ;
-            assert (q != NULL,      "invariant") ;
-            assert (q->_next == p,  "invariant") ;
-            q->_next = p->_next ;
+            assert(v != SelfNode, "invariant");
+            assert(p == SelfNode, "Node not found on cxq");
+            assert(p != _cxq, "invariant");
+            assert(q != NULL, "invariant");
+            assert(q->_next == p, "invariant");
+            q->_next = p->_next;
         }
-        TEVENT (Unlink from cxq) ;
+        TEVENT(Unlink from cxq);
     }
 
     // Diagnostic hygiene ...
-    SelfNode->_prev  = (ObjectWaiter *) 0xBAD ;
-    SelfNode->_next  = (ObjectWaiter *) 0xBAD ;
-    SelfNode->TState = ObjectWaiter::TS_RUN ;
+    SelfNode->_prev  = (ObjectWaiter *) 0xBAD;
+    SelfNode->_next  = (ObjectWaiter *) 0xBAD;
+    SelfNode->TState = ObjectWaiter::TS_RUN;
 }
 
 // -----------------------------------------------------------------------------
@@ -919,22 +919,22 @@
 // a monitor will use a timer.
 
 void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
-   Thread * Self = THREAD ;
+   Thread * Self = THREAD;
    if (THREAD != _owner) {
      if (THREAD->is_lock_owned((address) _owner)) {
        // Transmute _owner from a BasicLock pointer to a Thread address.
        // We don't need to hold _mutex for this transition.
        // Non-null to Non-null is safe as long as all readers can
        // tolerate either flavor.
-       assert (_recursions == 0, "invariant") ;
-       _owner = THREAD ;
-       _recursions = 0 ;
-       OwnerIsThread = 1 ;
+       assert(_recursions == 0, "invariant");
+       _owner = THREAD;
+       _recursions = 0;
+       OwnerIsThread = 1;
      } else {
        // NOTE: we need to handle unbalanced monitor enter/exit
        // in native code by throwing an exception.
        // TODO: Throw an IllegalMonitorStateException ?
-       TEVENT (Exit - Throw IMSX) ;
+       TEVENT(Exit - Throw IMSX);
        assert(false, "Non-balanced monitor enter/exit!");
        if (false) {
           THROW(vmSymbols::java_lang_IllegalMonitorStateException());
@@ -945,14 +945,14 @@
 
    if (_recursions != 0) {
      _recursions--;        // this is simple recursive enter
-     TEVENT (Inflated exit - recursive) ;
-     return ;
+     TEVENT(Inflated exit - recursive);
+     return;
    }
 
    // Invariant: after setting Responsible=null an thread must execute
    // a MEMBAR or other serializing instruction before fetching EntryList|cxq.
    if ((SyncFlags & 4) == 0) {
-      _Responsible = NULL ;
+      _Responsible = NULL;
    }
 
 #if INCLUDE_TRACE
@@ -964,7 +964,7 @@
 #endif
 
    for (;;) {
-      assert (THREAD == _owner, "invariant") ;
+      assert(THREAD == _owner, "invariant");
 
 
       if (Knob_ExitPolicy == 0) {
@@ -980,13 +980,13 @@
          // in massive wasteful coherency traffic on classic SMP systems.
          // Instead, I use release_store(), which is implemented as just a simple
          // ST on x64, x86 and SPARC.
-         OrderAccess::release_store_ptr (&_owner, NULL) ;   // drop the lock
-         OrderAccess::storeload() ;                         // See if we need to wake a successor
+         OrderAccess::release_store_ptr(&_owner, NULL);   // drop the lock
+         OrderAccess::storeload();                         // See if we need to wake a successor
          if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) {
-            TEVENT (Inflated exit - simple egress) ;
-            return ;
+            TEVENT(Inflated exit - simple egress);
+            return;
          }
-         TEVENT (Inflated exit - complex egress) ;
+         TEVENT(Inflated exit - complex egress);
 
          // Normally the exiting thread is responsible for ensuring succession,
          // but if other successors are ready or other entering threads are spinning
@@ -1026,17 +1026,17 @@
          // falls to the new owner.
          //
          if (Atomic::cmpxchg_ptr (THREAD, &_owner, NULL) != NULL) {
-            return ;
+            return;
          }
-         TEVENT (Exit - Reacquired) ;
+         TEVENT(Exit - Reacquired);
       } else {
          if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) {
-            OrderAccess::release_store_ptr (&_owner, NULL) ;   // drop the lock
-            OrderAccess::storeload() ;
+            OrderAccess::release_store_ptr(&_owner, NULL);   // drop the lock
+            OrderAccess::storeload();
             // Ratify the previously observed values.
             if (_cxq == NULL || _succ != NULL) {
-                TEVENT (Inflated exit - simple egress) ;
-                return ;
+                TEVENT(Inflated exit - simple egress);
+                return;
             }
 
             // inopportune interleaving -- the exiting thread (this thread)
@@ -1051,29 +1051,29 @@
             //     we could simply unpark() the lead thread and return
             //     without having set _succ.
             if (Atomic::cmpxchg_ptr (THREAD, &_owner, NULL) != NULL) {
-               TEVENT (Inflated exit - reacquired succeeded) ;
-               return ;
+               TEVENT(Inflated exit - reacquired succeeded);
+               return;
             }
-            TEVENT (Inflated exit - reacquired failed) ;
+            TEVENT(Inflated exit - reacquired failed);
          } else {
-            TEVENT (Inflated exit - complex egress) ;
+            TEVENT(Inflated exit - complex egress);
          }
       }
 
-      guarantee (_owner == THREAD, "invariant") ;
+      guarantee(_owner == THREAD, "invariant");
 
-      ObjectWaiter * w = NULL ;
-      int QMode = Knob_QMode ;
+      ObjectWaiter * w = NULL;
+      int QMode = Knob_QMode;
 
       if (QMode == 2 && _cxq != NULL) {
           // QMode == 2 : cxq has precedence over EntryList.
           // Try to directly wake a successor from the cxq.
           // If successful, the successor will need to unlink itself from cxq.
-          w = _cxq ;
-          assert (w != NULL, "invariant") ;
-          assert (w->TState == ObjectWaiter::TS_CXQ, "Invariant") ;
-          ExitEpilog (Self, w) ;
-          return ;
+          w = _cxq;
+          assert(w != NULL, "invariant");
+          assert(w->TState == ObjectWaiter::TS_CXQ, "Invariant");
+          ExitEpilog(Self, w);
+          return;
       }
 
       if (QMode == 3 && _cxq != NULL) {
@@ -1082,33 +1082,33 @@
           // Drain _cxq into EntryList - bulk transfer.
           // First, detach _cxq.
           // The following loop is tantamount to: w = swap (&cxq, NULL)
-          w = _cxq ;
+          w = _cxq;
           for (;;) {
-             assert (w != NULL, "Invariant") ;
-             ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr (NULL, &_cxq, w) ;
-             if (u == w) break ;
-             w = u ;
+             assert(w != NULL, "Invariant");
+             ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w);
+             if (u == w) break;
+             w = u;
           }
-          assert (w != NULL              , "invariant") ;
+          assert(w != NULL              , "invariant");
 
-          ObjectWaiter * q = NULL ;
-          ObjectWaiter * p ;
-          for (p = w ; p != NULL ; p = p->_next) {
-              guarantee (p->TState == ObjectWaiter::TS_CXQ, "Invariant") ;
-              p->TState = ObjectWaiter::TS_ENTER ;
-              p->_prev = q ;
-              q = p ;
+          ObjectWaiter * q = NULL;
+          ObjectWaiter * p;
+          for (p = w; p != NULL; p = p->_next) {
+              guarantee(p->TState == ObjectWaiter::TS_CXQ, "Invariant");
+              p->TState = ObjectWaiter::TS_ENTER;
+              p->_prev = q;
+              q = p;
           }
 
           // Append the RATs to the EntryList
           // TODO: organize EntryList as a CDLL so we can locate the tail in constant-time.
-          ObjectWaiter * Tail ;
-          for (Tail = _EntryList ; Tail != NULL && Tail->_next != NULL ; Tail = Tail->_next) ;
+          ObjectWaiter * Tail;
+          for (Tail = _EntryList; Tail != NULL && Tail->_next != NULL; Tail = Tail->_next);
           if (Tail == NULL) {
-              _EntryList = w ;
+              _EntryList = w;
           } else {
-              Tail->_next = w ;
-              w->_prev = Tail ;
+              Tail->_next = w;
+              w->_prev = Tail;
           }
 
           // Fall thru into code that tries to wake a successor from EntryList
@@ -1121,35 +1121,35 @@
           // Drain _cxq into EntryList - bulk transfer.
           // First, detach _cxq.
           // The following loop is tantamount to: w = swap (&cxq, NULL)
-          w = _cxq ;
+          w = _cxq;
           for (;;) {
-             assert (w != NULL, "Invariant") ;
-             ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr (NULL, &_cxq, w) ;
-             if (u == w) break ;
-             w = u ;
+             assert(w != NULL, "Invariant");
+             ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w);
+             if (u == w) break;
+             w = u;
           }
-          assert (w != NULL              , "invariant") ;
+          assert(w != NULL              , "invariant");
 
-          ObjectWaiter * q = NULL ;
-          ObjectWaiter * p ;
-          for (p = w ; p != NULL ; p = p->_next) {
-              guarantee (p->TState == ObjectWaiter::TS_CXQ, "Invariant") ;
-              p->TState = ObjectWaiter::TS_ENTER ;
-              p->_prev = q ;
-              q = p ;
+          ObjectWaiter * q = NULL;
+          ObjectWaiter * p;
+          for (p = w; p != NULL; p = p->_next) {
+              guarantee(p->TState == ObjectWaiter::TS_CXQ, "Invariant");
+              p->TState = ObjectWaiter::TS_ENTER;
+              p->_prev = q;
+              q = p;
           }
 
           // Prepend the RATs to the EntryList
           if (_EntryList != NULL) {
-              q->_next = _EntryList ;
-              _EntryList->_prev = q ;
+              q->_next = _EntryList;
+              _EntryList->_prev = q;
           }
-          _EntryList = w ;
+          _EntryList = w;
 
           // Fall thru into code that tries to wake a successor from EntryList
       }
 
-      w = _EntryList  ;
+      w = _EntryList;
       if (w != NULL) {
           // I'd like to write: guarantee (w->_thread != Self).
           // But in practice an exiting thread may find itself on the EntryList.
@@ -1162,29 +1162,29 @@
           // reacquires the lock and then finds itself on the EntryList.
           // Given all that, we have to tolerate the circumstance where "w" is
           // associated with Self.
-          assert (w->TState == ObjectWaiter::TS_ENTER, "invariant") ;
-          ExitEpilog (Self, w) ;
-          return ;
+          assert(w->TState == ObjectWaiter::TS_ENTER, "invariant");
+          ExitEpilog(Self, w);
+          return;
       }
 
       // If we find that both _cxq and EntryList are null then just
       // re-run the exit protocol from the top.
-      w = _cxq ;
-      if (w == NULL) continue ;
+      w = _cxq;
+      if (w == NULL) continue;
 
       // Drain _cxq into EntryList - bulk transfer.
       // First, detach _cxq.
       // The following loop is tantamount to: w = swap (&cxq, NULL)
       for (;;) {
-          assert (w != NULL, "Invariant") ;
-          ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr (NULL, &_cxq, w) ;
-          if (u == w) break ;
-          w = u ;
+          assert(w != NULL, "Invariant");
+          ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w);
+          if (u == w) break;
+          w = u;
       }
-      TEVENT (Inflated exit - drain cxq into EntryList) ;
+      TEVENT(Inflated exit - drain cxq into EntryList);
 
-      assert (w != NULL              , "invariant") ;
-      assert (_EntryList  == NULL    , "invariant") ;
+      assert(w != NULL              , "invariant");
+      assert(_EntryList  == NULL    , "invariant");
 
       // Convert the LIFO SLL anchored by _cxq into a DLL.
       // The list reorganization step operates in O(LENGTH(w)) time.
@@ -1198,30 +1198,30 @@
       if (QMode == 1) {
          // QMode == 1 : drain cxq to EntryList, reversing order
          // We also reverse the order of the list.
-         ObjectWaiter * s = NULL ;
-         ObjectWaiter * t = w ;
-         ObjectWaiter * u = NULL ;
+         ObjectWaiter * s = NULL;
+         ObjectWaiter * t = w;
+         ObjectWaiter * u = NULL;
          while (t != NULL) {
-             guarantee (t->TState == ObjectWaiter::TS_CXQ, "invariant") ;
-             t->TState = ObjectWaiter::TS_ENTER ;
-             u = t->_next ;
-             t->_prev = u ;
-             t->_next = s ;
+             guarantee(t->TState == ObjectWaiter::TS_CXQ, "invariant");
+             t->TState = ObjectWaiter::TS_ENTER;
+             u = t->_next;
+             t->_prev = u;
+             t->_next = s;
              s = t;
-             t = u ;
+             t = u;
          }
-         _EntryList  = s ;
-         assert (s != NULL, "invariant") ;
+         _EntryList  = s;
+         assert(s != NULL, "invariant");
       } else {
          // QMode == 0 or QMode == 2
-         _EntryList = w ;
-         ObjectWaiter * q = NULL ;
-         ObjectWaiter * p ;
-         for (p = w ; p != NULL ; p = p->_next) {
-             guarantee (p->TState == ObjectWaiter::TS_CXQ, "Invariant") ;
-             p->TState = ObjectWaiter::TS_ENTER ;
-             p->_prev = q ;
-             q = p ;
+         _EntryList = w;
+         ObjectWaiter * q = NULL;
+         ObjectWaiter * p;
+         for (p = w; p != NULL; p = p->_next) {
+             guarantee(p->TState == ObjectWaiter::TS_CXQ, "Invariant");
+             p->TState = ObjectWaiter::TS_ENTER;
+             p->_prev = q;
+             q = p;
          }
       }
 
@@ -1233,11 +1233,11 @@
       // context-switch rate.
       if (_succ != NULL) continue;
 
-      w = _EntryList  ;
+      w = _EntryList;
       if (w != NULL) {
-          guarantee (w->TState == ObjectWaiter::TS_ENTER, "invariant") ;
-          ExitEpilog (Self, w) ;
-          return ;
+          guarantee(w->TState == ObjectWaiter::TS_ENTER, "invariant");
+          ExitEpilog(Self, w);
+          return;
       }
    }
 }
@@ -1275,22 +1275,22 @@
 
 
 bool ObjectMonitor::ExitSuspendEquivalent (JavaThread * jSelf) {
-   int Mode = Knob_FastHSSEC ;
+   int Mode = Knob_FastHSSEC;
    if (Mode && !jSelf->is_external_suspend()) {
-      assert (jSelf->is_suspend_equivalent(), "invariant") ;
-      jSelf->clear_suspend_equivalent() ;
-      if (2 == Mode) OrderAccess::storeload() ;
-      if (!jSelf->is_external_suspend()) return false ;
+      assert(jSelf->is_suspend_equivalent(), "invariant");
+      jSelf->clear_suspend_equivalent();
+      if (2 == Mode) OrderAccess::storeload();
+      if (!jSelf->is_external_suspend()) return false;
       // We raced a suspension -- fall thru into the slow path
-      TEVENT (ExitSuspendEquivalent - raced) ;
-      jSelf->set_suspend_equivalent() ;
+      TEVENT(ExitSuspendEquivalent - raced);
+      jSelf->set_suspend_equivalent();
    }
-   return jSelf->handle_special_suspend_equivalent_condition() ;
+   return jSelf->handle_special_suspend_equivalent_condition();
 }
 
 
 void ObjectMonitor::ExitEpilog (Thread * Self, ObjectWaiter * Wakee) {
-   assert (_owner == Self, "invariant") ;
+   assert(_owner == Self, "invariant");
 
    // Exit protocol:
    // 1. ST _succ = wakee
@@ -1298,28 +1298,28 @@
    // 2. ST _owner = NULL
    // 3. unpark(wakee)
 
-   _succ = Knob_SuccEnabled ? Wakee->_thread : NULL ;
-   ParkEvent * Trigger = Wakee->_event ;
+   _succ = Knob_SuccEnabled ? Wakee->_thread : NULL;
+   ParkEvent * Trigger = Wakee->_event;
 
    // Hygiene -- once we've set _owner = NULL we can't safely dereference Wakee again.
    // The thread associated with Wakee may have grabbed the lock and "Wakee" may be
    // out-of-scope (non-extant).
-   Wakee  = NULL ;
+   Wakee  = NULL;
 
    // Drop the lock
-   OrderAccess::release_store_ptr (&_owner, NULL) ;
-   OrderAccess::fence() ;                               // ST _owner vs LD in unpark()
+   OrderAccess::release_store_ptr(&_owner, NULL);
+   OrderAccess::fence();                               // ST _owner vs LD in unpark()
 
    if (SafepointSynchronize::do_call_back()) {
-      TEVENT (unpark before SAFEPOINT) ;
+      TEVENT(unpark before SAFEPOINT);
    }
 
    DTRACE_MONITOR_PROBE(contended__exit, this, object(), Self);
-   Trigger->unpark() ;
+   Trigger->unpark();
 
    // Maintain stats and report events to JVMTI
    if (ObjectMonitor::_sync_Parks != NULL) {
-      ObjectMonitor::_sync_Parks->inc() ;
+      ObjectMonitor::_sync_Parks->inc();
    }
 }
 
@@ -1343,17 +1343,17 @@
    if (THREAD != _owner) {
     if (THREAD->is_lock_owned ((address)_owner)) {
        assert(_recursions == 0, "internal state error");
-       _owner = THREAD ;   /* Convert from basiclock addr to Thread addr */
-       _recursions = 0 ;
-       OwnerIsThread = 1 ;
+       _owner = THREAD;   /* Convert from basiclock addr to Thread addr */
+       _recursions = 0;
+       OwnerIsThread = 1;
     }
    }
 
    guarantee(Self == _owner, "complete_exit not owner");
    intptr_t save = _recursions; // record the old recursion count
    _recursions = 0;        // set the recursion level to be 0
-   exit (true, Self) ;           // exit the monitor
-   guarantee (_owner != Self, "invariant");
+   exit(true, Self);           // exit the monitor
+   guarantee(_owner != Self, "invariant");
    return save;
 }
 
@@ -1365,8 +1365,8 @@
    JavaThread *jt = (JavaThread *)THREAD;
 
    guarantee(_owner != Self, "reenter already owner");
-   enter (THREAD);       // enter the monitor
-   guarantee (_recursions == 0, "reenter recursion");
+   enter(THREAD);       // enter the monitor
+   guarantee(_recursions == 0, "reenter recursion");
    _recursions = recursions;
    return;
 }
@@ -1382,11 +1382,11 @@
   do {                                                                            \
     if (THREAD != _owner) {                                                       \
       if (THREAD->is_lock_owned((address) _owner)) {                              \
-        _owner = THREAD ;  /* Convert from basiclock addr to Thread addr */       \
+        _owner = THREAD;  /* Convert from basiclock addr to Thread addr */       \
         _recursions = 0;                                                          \
-        OwnerIsThread = 1 ;                                                       \
+        OwnerIsThread = 1;                                                       \
       } else {                                                                    \
-        TEVENT (Throw IMSX) ;                                                     \
+        TEVENT(Throw IMSX);                                                     \
         THROW(vmSymbols::java_lang_IllegalMonitorStateException());               \
       }                                                                           \
     }                                                                             \
@@ -1396,15 +1396,15 @@
 // TODO-FIXME: remove check_slow() -- it's likely dead.
 
 void ObjectMonitor::check_slow(TRAPS) {
-  TEVENT (check_slow - throw IMSX) ;
+  TEVENT(check_slow - throw IMSX);
   assert(THREAD != _owner && !THREAD->is_lock_owned((address) _owner), "must not be owner");
   THROW_MSG(vmSymbols::java_lang_IllegalMonitorStateException(), "current thread not owner");
 }
 
 static int Adjust (volatile int * adr, int dx) {
-  int v ;
-  for (v = *adr ; Atomic::cmpxchg (v + dx, adr, v) != v; v = *adr) ;
-  return v ;
+  int v;
+  for (v = *adr; Atomic::cmpxchg(v + dx, adr, v) != v; v = *adr);
+  return v;
 }
 
 // helper method for posting a monitor wait event
@@ -1426,11 +1426,11 @@
 // Note: a subset of changes to ObjectMonitor::wait()
 // will need to be replicated in complete_exit above
 void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
-   Thread * const Self = THREAD ;
+   Thread * const Self = THREAD;
    assert(Self->is_Java_thread(), "Must be Java thread!");
    JavaThread *jt = (JavaThread *)THREAD;
 
-   DeferredInitialize () ;
+   DeferredInitialize();
 
    // Throw IMSX or IEX.
    CHECK_OWNER();
@@ -1456,23 +1456,23 @@
      if (event.should_commit()) {
        post_monitor_wait_event(&event, 0, millis, false);
      }
-     TEVENT (Wait - Throw IEX) ;
+     TEVENT(Wait - Throw IEX);
      THROW(vmSymbols::java_lang_InterruptedException());
-     return ;
+     return;
    }
 
-   TEVENT (Wait) ;
+   TEVENT(Wait);
 
-   assert (Self->_Stalled == 0, "invariant") ;
-   Self->_Stalled = intptr_t(this) ;
+   assert(Self->_Stalled == 0, "invariant");
+   Self->_Stalled = intptr_t(this);
    jt->set_current_waiting_monitor(this);
 
    // create a node to be put into the queue
    // Critically, after we reset() the event but prior to park(), we must check
    // for a pending interrupt.
    ObjectWaiter node(Self);
-   node.TState = ObjectWaiter::TS_WAIT ;
-   Self->_ParkEvent->reset() ;
+   node.TState = ObjectWaiter::TS_WAIT;
+   Self->_ParkEvent->reset();
    OrderAccess::fence();          // ST into Event; membar ; LD interrupted-flag
 
    // Enter the waiting queue, which is a circular doubly linked list in this case
@@ -1482,18 +1482,18 @@
    // returns because of a timeout of interrupt.  Contention is exceptionally rare
    // so we use a simple spin-lock instead of a heavier-weight blocking lock.
 
-   Thread::SpinAcquire (&_WaitSetLock, "WaitSet - add") ;
-   AddWaiter (&node) ;
-   Thread::SpinRelease (&_WaitSetLock) ;
+   Thread::SpinAcquire(&_WaitSetLock, "WaitSet - add");
+   AddWaiter(&node);
+   Thread::SpinRelease(&_WaitSetLock);
 
    if ((SyncFlags & 4) == 0) {
-      _Responsible = NULL ;
+      _Responsible = NULL;
    }
    intptr_t save = _recursions; // record the old recursion count
    _waiters++;                  // increment the number of waiters
    _recursions = 0;             // set the recursion level to be 1
-   exit (true, Self) ;                    // exit the monitor
-   guarantee (_owner != Self, "invariant") ;
+   exit(true, Self);                    // exit the monitor
+   guarantee(_owner != Self, "invariant");
 
    // The thread is on the WaitSet list - now park() it.
    // On MP systems it's conceivable that a brief spin before we park
@@ -1502,8 +1502,8 @@
    // TODO-FIXME: change the following logic to a loop of the form
    //   while (!timeout && !interrupted && _notified == 0) park()
 
-   int ret = OS_OK ;
-   int WasNotified = 0 ;
+   int ret = OS_OK;
+   int WasNotified = 0;
    { // State transition wrappers
      OSThread* osthread = Self->osthread();
      OSThreadWaitState osts(osthread, true);
@@ -1517,9 +1517,9 @@
        } else
        if (node._notified == 0) {
          if (millis <= 0) {
-            Self->_ParkEvent->park () ;
+            Self->_ParkEvent->park();
          } else {
-            ret = Self->_ParkEvent->park (millis) ;
+            ret = Self->_ParkEvent->park(millis);
          }
        }
 
@@ -1548,23 +1548,23 @@
      // That is, we fail toward safety.
 
      if (node.TState == ObjectWaiter::TS_WAIT) {
-         Thread::SpinAcquire (&_WaitSetLock, "WaitSet - unlink") ;
+         Thread::SpinAcquire(&_WaitSetLock, "WaitSet - unlink");
          if (node.TState == ObjectWaiter::TS_WAIT) {
-            DequeueSpecificWaiter (&node) ;       // unlink from WaitSet
+            DequeueSpecificWaiter(&node);       // unlink from WaitSet
             assert(node._notified == 0, "invariant");
-            node.TState = ObjectWaiter::TS_RUN ;
+            node.TState = ObjectWaiter::TS_RUN;
          }
-         Thread::SpinRelease (&_WaitSetLock) ;
+         Thread::SpinRelease(&_WaitSetLock);
      }
 
      // The thread is now either on off-list (TS_RUN),
      // on the EntryList (TS_ENTER), or on the cxq (TS_CXQ).
      // The Node's TState variable is stable from the perspective of this thread.
      // No other threads will asynchronously modify TState.
-     guarantee (node.TState != ObjectWaiter::TS_WAIT, "invariant") ;
-     OrderAccess::loadload() ;
-     if (_succ == Self) _succ = NULL ;
-     WasNotified = node._notified ;
+     guarantee(node.TState != ObjectWaiter::TS_WAIT, "invariant");
+     OrderAccess::loadload();
+     if (_succ == Self) _succ = NULL;
+     WasNotified = node._notified;
 
      // Reentry phase -- reacquire the monitor.
      // re-enter contended monitor after object.wait().
@@ -1601,18 +1601,18 @@
        post_monitor_wait_event(&event, node._notifier_tid, millis, ret == OS_TIMEOUT);
      }
 
-     OrderAccess::fence() ;
+     OrderAccess::fence();
 
-     assert (Self->_Stalled != 0, "invariant") ;
-     Self->_Stalled = 0 ;
+     assert(Self->_Stalled != 0, "invariant");
+     Self->_Stalled = 0;
 
-     assert (_owner != Self, "invariant") ;
-     ObjectWaiter::TStates v = node.TState ;
+     assert(_owner != Self, "invariant");
+     ObjectWaiter::TStates v = node.TState;
      if (v == ObjectWaiter::TS_RUN) {
-         enter (Self) ;
+         enter(Self);
      } else {
-         guarantee (v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant") ;
-         ReenterI (Self, &node) ;
+         guarantee(v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant");
+         ReenterI(Self, &node);
          node.wait_reenter_end(this);
      }
 
@@ -1620,24 +1620,24 @@
      // Lifecycle - the node representing Self must not appear on any queues.
      // Node is about to go out-of-scope, but even if it were immortal we wouldn't
      // want residual elements associated with this thread left on any lists.
-     guarantee (node.TState == ObjectWaiter::TS_RUN, "invariant") ;
-     assert    (_owner == Self, "invariant") ;
-     assert    (_succ != Self , "invariant") ;
+     guarantee(node.TState == ObjectWaiter::TS_RUN, "invariant");
+     assert(_owner == Self, "invariant");
+     assert(_succ != Self , "invariant");
    } // OSThreadWaitState()
 
    jt->set_current_waiting_monitor(NULL);
 
-   guarantee (_recursions == 0, "invariant") ;
+   guarantee(_recursions == 0, "invariant");
    _recursions = save;     // restore the old recursion count
    _waiters--;             // decrement the number of waiters
 
    // Verify a few postconditions
-   assert (_owner == Self       , "invariant") ;
-   assert (_succ  != Self       , "invariant") ;
-   assert (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ;
+   assert(_owner == Self       , "invariant");
+   assert(_succ  != Self       , "invariant");
+   assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant");
 
    if (SyncFlags & 32) {
-      OrderAccess::fence() ;
+      OrderAccess::fence();
    }
 
    // check if the notification happened
@@ -1645,7 +1645,7 @@
      // no, it could be timeout or Thread.interrupt() or both
      // check for interrupt event, otherwise it is timeout
      if (interruptible && Thread::is_interrupted(Self, true) && !HAS_PENDING_EXCEPTION) {
-       TEVENT (Wait - throw IEX from epilog) ;
+       TEVENT(Wait - throw IEX from epilog);
        THROW(vmSymbols::java_lang_InterruptedException());
      }
    }
@@ -1663,99 +1663,99 @@
 void ObjectMonitor::notify(TRAPS) {
   CHECK_OWNER();
   if (_WaitSet == NULL) {
-     TEVENT (Empty-Notify) ;
-     return ;
+     TEVENT(Empty-Notify);
+     return;
   }
   DTRACE_MONITOR_PROBE(notify, this, object(), THREAD);
 
-  int Policy = Knob_MoveNotifyee ;
+  int Policy = Knob_MoveNotifyee;
 
-  Thread::SpinAcquire (&_WaitSetLock, "WaitSet - notify") ;
-  ObjectWaiter * iterator = DequeueWaiter() ;
+  Thread::SpinAcquire(&_WaitSetLock, "WaitSet - notify");
+  ObjectWaiter * iterator = DequeueWaiter();
   if (iterator != NULL) {
-     TEVENT (Notify1 - Transfer) ;
-     guarantee (iterator->TState == ObjectWaiter::TS_WAIT, "invariant") ;
-     guarantee (iterator->_notified == 0, "invariant") ;
+     TEVENT(Notify1 - Transfer);
+     guarantee(iterator->TState == ObjectWaiter::TS_WAIT, "invariant");
+     guarantee(iterator->_notified == 0, "invariant");
      if (Policy != 4) {
-        iterator->TState = ObjectWaiter::TS_ENTER ;
+        iterator->TState = ObjectWaiter::TS_ENTER;
      }
-     iterator->_notified = 1 ;
+     iterator->_notified = 1;
      Thread * Self = THREAD;
      iterator->_notifier_tid = Self->osthread()->thread_id();
 
-     ObjectWaiter * List = _EntryList ;
+     ObjectWaiter * List = _EntryList;
      if (List != NULL) {
-        assert (List->_prev == NULL, "invariant") ;
-        assert (List->TState == ObjectWaiter::TS_ENTER, "invariant") ;
-        assert (List != iterator, "invariant") ;
+        assert(List->_prev == NULL, "invariant");
+        assert(List->TState == ObjectWaiter::TS_ENTER, "invariant");
+        assert(List != iterator, "invariant");
      }
 
      if (Policy == 0) {       // prepend to EntryList
          if (List == NULL) {
-             iterator->_next = iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             iterator->_next = iterator->_prev = NULL;
+             _EntryList = iterator;
          } else {
-             List->_prev = iterator ;
-             iterator->_next = List ;
-             iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             List->_prev = iterator;
+             iterator->_next = List;
+             iterator->_prev = NULL;
+             _EntryList = iterator;
         }
      } else
      if (Policy == 1) {      // append to EntryList
          if (List == NULL) {
-             iterator->_next = iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             iterator->_next = iterator->_prev = NULL;
+             _EntryList = iterator;
          } else {
             // CONSIDER:  finding the tail currently requires a linear-time walk of
             // the EntryList.  We can make tail access constant-time by converting to
             // a CDLL instead of using our current DLL.
-            ObjectWaiter * Tail ;
-            for (Tail = List ; Tail->_next != NULL ; Tail = Tail->_next) ;
-            assert (Tail != NULL && Tail->_next == NULL, "invariant") ;
-            Tail->_next = iterator ;
-            iterator->_prev = Tail ;
-            iterator->_next = NULL ;
+            ObjectWaiter * Tail;
+            for (Tail = List; Tail->_next != NULL; Tail = Tail->_next);
+            assert(Tail != NULL && Tail->_next == NULL, "invariant");
+            Tail->_next = iterator;
+            iterator->_prev = Tail;
+            iterator->_next = NULL;
         }
      } else
      if (Policy == 2) {      // prepend to cxq
          // prepend to cxq
          if (List == NULL) {
-             iterator->_next = iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             iterator->_next = iterator->_prev = NULL;
+             _EntryList = iterator;
          } else {
-            iterator->TState = ObjectWaiter::TS_CXQ ;
+            iterator->TState = ObjectWaiter::TS_CXQ;
             for (;;) {
-                ObjectWaiter * Front = _cxq ;
-                iterator->_next = Front ;
+                ObjectWaiter * Front = _cxq;
+                iterator->_next = Front;
                 if (Atomic::cmpxchg_ptr (iterator, &_cxq, Front) == Front) {
-                    break ;
+                    break;
                 }
             }
          }
      } else
      if (Policy == 3) {      // append to cxq
-        iterator->TState = ObjectWaiter::TS_CXQ ;
+        iterator->TState = ObjectWaiter::TS_CXQ;
         for (;;) {
-            ObjectWaiter * Tail ;
-            Tail = _cxq ;
+            ObjectWaiter * Tail;
+            Tail = _cxq;
             if (Tail == NULL) {
-                iterator->_next = NULL ;
+                iterator->_next = NULL;
                 if (Atomic::cmpxchg_ptr (iterator, &_cxq, NULL) == NULL) {
-                   break ;
+                   break;
                 }
             } else {
-                while (Tail->_next != NULL) Tail = Tail->_next ;
-                Tail->_next = iterator ;
-                iterator->_prev = Tail ;
-                iterator->_next = NULL ;
-                break ;
+                while (Tail->_next != NULL) Tail = Tail->_next;
+                Tail->_next = iterator;
+                iterator->_prev = Tail;
+                iterator->_next = NULL;
+                break;
             }
         }
      } else {
-        ParkEvent * ev = iterator->_event ;
-        iterator->TState = ObjectWaiter::TS_RUN ;
-        OrderAccess::fence() ;
-        ev->unpark() ;
+        ParkEvent * ev = iterator->_event;
+        iterator->TState = ObjectWaiter::TS_RUN;
+        OrderAccess::fence();
+        ev->unpark();
      }
 
      if (Policy < 4) {
@@ -1771,10 +1771,10 @@
      // critical section.
   }
 
-  Thread::SpinRelease (&_WaitSetLock) ;
+  Thread::SpinRelease(&_WaitSetLock);
 
   if (iterator != NULL && ObjectMonitor::_sync_Notifications != NULL) {
-     ObjectMonitor::_sync_Notifications->inc() ;
+     ObjectMonitor::_sync_Notifications->inc();
   }
 }
 
@@ -1783,103 +1783,103 @@
   CHECK_OWNER();
   ObjectWaiter* iterator;
   if (_WaitSet == NULL) {
-      TEVENT (Empty-NotifyAll) ;
-      return ;
+      TEVENT(Empty-NotifyAll);
+      return;
   }
   DTRACE_MONITOR_PROBE(notifyAll, this, object(), THREAD);
 
-  int Policy = Knob_MoveNotifyee ;
-  int Tally = 0 ;
-  Thread::SpinAcquire (&_WaitSetLock, "WaitSet - notifyall") ;
+  int Policy = Knob_MoveNotifyee;
+  int Tally = 0;
+  Thread::SpinAcquire(&_WaitSetLock, "WaitSet - notifyall");
 
   for (;;) {
-     iterator = DequeueWaiter () ;
-     if (iterator == NULL) break ;
-     TEVENT (NotifyAll - Transfer1) ;
-     ++Tally ;
+     iterator = DequeueWaiter();
+     if (iterator == NULL) break;
+     TEVENT(NotifyAll - Transfer1);
+     ++Tally;
 
      // Disposition - what might we do with iterator ?
      // a.  add it directly to the EntryList - either tail or head.
      // b.  push it onto the front of the _cxq.
      // For now we use (a).
 
-     guarantee (iterator->TState == ObjectWaiter::TS_WAIT, "invariant") ;
-     guarantee (iterator->_notified == 0, "invariant") ;
-     iterator->_notified = 1 ;
+     guarantee(iterator->TState == ObjectWaiter::TS_WAIT, "invariant");
+     guarantee(iterator->_notified == 0, "invariant");
+     iterator->_notified = 1;
      Thread * Self = THREAD;
      iterator->_notifier_tid = Self->osthread()->thread_id();
      if (Policy != 4) {
-        iterator->TState = ObjectWaiter::TS_ENTER ;
+        iterator->TState = ObjectWaiter::TS_ENTER;
      }
 
-     ObjectWaiter * List = _EntryList ;
+     ObjectWaiter * List = _EntryList;
      if (List != NULL) {
-        assert (List->_prev == NULL, "invariant") ;
-        assert (List->TState == ObjectWaiter::TS_ENTER, "invariant") ;
-        assert (List != iterator, "invariant") ;
+        assert(List->_prev == NULL, "invariant");
+        assert(List->TState == ObjectWaiter::TS_ENTER, "invariant");
+        assert(List != iterator, "invariant");
      }
 
      if (Policy == 0) {       // prepend to EntryList
          if (List == NULL) {
-             iterator->_next = iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             iterator->_next = iterator->_prev = NULL;
+             _EntryList = iterator;
          } else {
-             List->_prev = iterator ;
-             iterator->_next = List ;
-             iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             List->_prev = iterator;
+             iterator->_next = List;
+             iterator->_prev = NULL;
+             _EntryList = iterator;
         }
      } else
      if (Policy == 1) {      // append to EntryList
          if (List == NULL) {
-             iterator->_next = iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             iterator->_next = iterator->_prev = NULL;
+             _EntryList = iterator;
          } else {
             // CONSIDER:  finding the tail currently requires a linear-time walk of
             // the EntryList.  We can make tail access constant-time by converting to
             // a CDLL instead of using our current DLL.
-            ObjectWaiter * Tail ;
-            for (Tail = List ; Tail->_next != NULL ; Tail = Tail->_next) ;
-            assert (Tail != NULL && Tail->_next == NULL, "invariant") ;
-            Tail->_next = iterator ;
-            iterator->_prev = Tail ;
-            iterator->_next = NULL ;
+            ObjectWaiter * Tail;
+            for (Tail = List; Tail->_next != NULL; Tail = Tail->_next);
+            assert(Tail != NULL && Tail->_next == NULL, "invariant");
+            Tail->_next = iterator;
+            iterator->_prev = Tail;
+            iterator->_next = NULL;
         }
      } else
      if (Policy == 2) {      // prepend to cxq
          // prepend to cxq
-         iterator->TState = ObjectWaiter::TS_CXQ ;
+         iterator->TState = ObjectWaiter::TS_CXQ;
          for (;;) {
-             ObjectWaiter * Front = _cxq ;
-             iterator->_next = Front ;
+             ObjectWaiter * Front = _cxq;
+             iterator->_next = Front;
              if (Atomic::cmpxchg_ptr (iterator, &_cxq, Front) == Front) {
-                 break ;
+                 break;
              }
          }
      } else
      if (Policy == 3) {      // append to cxq
-        iterator->TState = ObjectWaiter::TS_CXQ ;
+        iterator->TState = ObjectWaiter::TS_CXQ;
         for (;;) {
-            ObjectWaiter * Tail ;
-            Tail = _cxq ;
+            ObjectWaiter * Tail;
+            Tail = _cxq;
             if (Tail == NULL) {
-                iterator->_next = NULL ;
+                iterator->_next = NULL;
                 if (Atomic::cmpxchg_ptr (iterator, &_cxq, NULL) == NULL) {
-                   break ;
+                   break;
                 }
             } else {
-                while (Tail->_next != NULL) Tail = Tail->_next ;
-                Tail->_next = iterator ;
-                iterator->_prev = Tail ;
-                iterator->_next = NULL ;
-                break ;
+                while (Tail->_next != NULL) Tail = Tail->_next;
+                Tail->_next = iterator;
+                iterator->_prev = Tail;
+                iterator->_next = NULL;
+                break;
             }
         }
      } else {
-        ParkEvent * ev = iterator->_event ;
-        iterator->TState = ObjectWaiter::TS_RUN ;
-        OrderAccess::fence() ;
-        ev->unpark() ;
+        ParkEvent * ev = iterator->_event;
+        iterator->TState = ObjectWaiter::TS_RUN;
+        OrderAccess::fence();
+        ev->unpark();
      }
 
      if (Policy < 4) {
@@ -1895,10 +1895,10 @@
      // critical section.
   }
 
-  Thread::SpinRelease (&_WaitSetLock) ;
+  Thread::SpinRelease(&_WaitSetLock);
 
   if (Tally != 0 && ObjectMonitor::_sync_Notifications != NULL) {
-     ObjectMonitor::_sync_Notifications->inc(Tally) ;
+     ObjectMonitor::_sync_Notifications->inc(Tally);
   }
 }
 
@@ -1968,8 +1968,8 @@
 // not spinning.
 //
 
-intptr_t ObjectMonitor::SpinCallbackArgument = 0 ;
-int (*ObjectMonitor::SpinCallbackFunction)(intptr_t, int) = NULL ;
+intptr_t ObjectMonitor::SpinCallbackArgument = 0;
+int (*ObjectMonitor::SpinCallbackFunction)(intptr_t, int) = NULL;
 
 // Spinning: Fixed frequency (100%), vary duration
 
@@ -1977,28 +1977,28 @@
 int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) {
 
     // Dumb, brutal spin.  Good for comparative measurements against adaptive spinning.
-    int ctr = Knob_FixedSpin ;
+    int ctr = Knob_FixedSpin;
     if (ctr != 0) {
         while (--ctr >= 0) {
-            if (TryLock (Self) > 0) return 1 ;
-            SpinPause () ;
+            if (TryLock(Self) > 0) return 1;
+            SpinPause();
         }
-        return 0 ;
+        return 0;
     }
 
-    for (ctr = Knob_PreSpin + 1; --ctr >= 0 ; ) {
+    for (ctr = Knob_PreSpin + 1; --ctr >= 0;) {
       if (TryLock(Self) > 0) {
         // Increase _SpinDuration ...
         // Note that we don't clamp SpinDuration precisely at SpinLimit.
         // Raising _SpurDuration to the poverty line is key.
-        int x = _SpinDuration ;
+        int x = _SpinDuration;
         if (x < Knob_SpinLimit) {
-           if (x < Knob_Poverty) x = Knob_Poverty ;
-           _SpinDuration = x + Knob_BonusB ;
+           if (x < Knob_Poverty) x = Knob_Poverty;
+           _SpinDuration = x + Knob_BonusB;
         }
-        return 1 ;
+        return 1;
       }
-      SpinPause () ;
+      SpinPause();
     }
 
     // Admission control - verify preconditions for spinning
@@ -2015,37 +2015,37 @@
     // This takes us into the realm of 1-out-of-N spinning, where we
     // hold the duration constant but vary the frequency.
 
-    ctr = _SpinDuration  ;
-    if (ctr < Knob_SpinBase) ctr = Knob_SpinBase ;
-    if (ctr <= 0) return 0 ;
+    ctr = _SpinDuration;
+    if (ctr < Knob_SpinBase) ctr = Knob_SpinBase;
+    if (ctr <= 0) return 0;
 
-    if (Knob_SuccRestrict && _succ != NULL) return 0 ;
+    if (Knob_SuccRestrict && _succ != NULL) return 0;
     if (Knob_OState && NotRunnable (Self, (Thread *) _owner)) {
-       TEVENT (Spin abort - notrunnable [TOP]);
-       return 0 ;
+       TEVENT(Spin abort - notrunnable [TOP]);
+       return 0;
     }
 
-    int MaxSpin = Knob_MaxSpinners ;
+    int MaxSpin = Knob_MaxSpinners;
     if (MaxSpin >= 0) {
        if (_Spinner > MaxSpin) {
-          TEVENT (Spin abort -- too many spinners) ;
-          return 0 ;
+          TEVENT(Spin abort -- too many spinners);
+          return 0;
        }
        // Slightly racy, but benign ...
-       Adjust (&_Spinner, 1) ;
+       Adjust(&_Spinner, 1);
     }
 
     // We're good to spin ... spin ingress.
     // CONSIDER: use Prefetch::write() to avoid RTS->RTO upgrades
     // when preparing to LD...CAS _owner, etc and the CAS is likely
     // to succeed.
-    int hits    = 0 ;
-    int msk     = 0 ;
-    int caspty  = Knob_CASPenalty ;
-    int oxpty   = Knob_OXPenalty ;
-    int sss     = Knob_SpinSetSucc ;
-    if (sss && _succ == NULL ) _succ = Self ;
-    Thread * prv = NULL ;
+    int hits    = 0;
+    int msk     = 0;
+    int caspty  = Knob_CASPenalty;
+    int oxpty   = Knob_OXPenalty;
+    int sss     = Knob_SpinSetSucc;
+    if (sss && _succ == NULL) _succ = Self;
+    Thread * prv = NULL;
 
     // There are three ways to exit the following loop:
     // 1.  A successful spin where this thread has acquired the lock.
@@ -2065,18 +2065,18 @@
       // We periodically check to see if there's a safepoint pending.
       if ((ctr & 0xFF) == 0) {
          if (SafepointSynchronize::do_call_back()) {
-            TEVENT (Spin: safepoint) ;
-            goto Abort ;           // abrupt spin egress
+            TEVENT(Spin: safepoint);
+            goto Abort;           // abrupt spin egress
          }
-         if (Knob_UsePause & 1) SpinPause () ;
+         if (Knob_UsePause & 1) SpinPause();
 
-         int (*scb)(intptr_t,int) = SpinCallbackFunction ;
+         int (*scb)(intptr_t,int) = SpinCallbackFunction;
          if (hits > 50 && scb != NULL) {
-            int abend = (*scb)(SpinCallbackArgument, 0) ;
+            int abend = (*scb)(SpinCallbackArgument, 0);
          }
       }
 
-      if (Knob_UsePause & 2) SpinPause() ;
+      if (Knob_UsePause & 2) SpinPause();
 
       // Exponential back-off ...  Stay off the bus to reduce coherency traffic.
       // This is useful on classic SMP systems, but is of less utility on
@@ -2093,12 +2093,12 @@
       // coherency bandwidth.  Relatedly, if we _oversample _owner we
       // can inadvertently interfere with the the ST m->owner=null.
       // executed by the lock owner.
-      if (ctr & msk) continue ;
-      ++hits ;
+      if (ctr & msk) continue;
+      ++hits;
       if ((hits & 0xF) == 0) {
         // The 0xF, above, corresponds to the exponent.
         // Consider: (msk+1)|msk
-        msk = ((msk << 2)|3) & BackOffMask ;
+        msk = ((msk << 2)|3) & BackOffMask;
       }
 
       // Probe _owner with TATAS
@@ -2111,16 +2111,16 @@
       // the spin without prejudice or apply a "penalty" to the
       // spin count-down variable "ctr", reducing it by 100, say.
 
-      Thread * ox = (Thread *) _owner ;
+      Thread * ox = (Thread *) _owner;
       if (ox == NULL) {
-         ox = (Thread *) Atomic::cmpxchg_ptr (Self, &_owner, NULL) ;
+         ox = (Thread *) Atomic::cmpxchg_ptr(Self, &_owner, NULL);
          if (ox == NULL) {
             // The CAS succeeded -- this thread acquired ownership
             // Take care of some bookkeeping to exit spin state.
             if (sss && _succ == Self) {
-               _succ = NULL ;
+               _succ = NULL;
             }
-            if (MaxSpin > 0) Adjust (&_Spinner, -1) ;
+            if (MaxSpin > 0) Adjust(&_Spinner, -1);
 
             // Increase _SpinDuration :
             // The spin was successful (profitable) so we tend toward
@@ -2129,12 +2129,12 @@
             // If we acquired the lock early in the spin cycle it
             // makes sense to increase _SpinDuration proportionally.
             // Note that we don't clamp SpinDuration precisely at SpinLimit.
-            int x = _SpinDuration ;
+            int x = _SpinDuration;
             if (x < Knob_SpinLimit) {
-                if (x < Knob_Poverty) x = Knob_Poverty ;
-                _SpinDuration = x + Knob_Bonus ;
+                if (x < Knob_Poverty) x = Knob_Poverty;
+                _SpinDuration = x + Knob_Bonus;
             }
-            return 1 ;
+            return 1;
          }
 
          // The CAS failed ... we can take any of the following actions:
@@ -2142,61 +2142,61 @@
          // * exit spin with prejudice -- goto Abort;
          // * exit spin without prejudice.
          // * Since CAS is high-latency, retry again immediately.
-         prv = ox ;
-         TEVENT (Spin: cas failed) ;
-         if (caspty == -2) break ;
-         if (caspty == -1) goto Abort ;
-         ctr -= caspty ;
-         continue ;
+         prv = ox;
+         TEVENT(Spin: cas failed);
+         if (caspty == -2) break;
+         if (caspty == -1) goto Abort;
+         ctr -= caspty;
+         continue;
       }
 
       // Did lock ownership change hands ?
-      if (ox != prv && prv != NULL ) {
-          TEVENT (spin: Owner changed)
-          if (oxpty == -2) break ;
-          if (oxpty == -1) goto Abort ;
-          ctr -= oxpty ;
+      if (ox != prv && prv != NULL) {
+          TEVENT(spin: Owner changed)
+          if (oxpty == -2) break;
+          if (oxpty == -1) goto Abort;
+          ctr -= oxpty;
       }
-      prv = ox ;
+      prv = ox;
 
       // Abort the spin if the owner is not executing.
       // The owner must be executing in order to drop the lock.
       // Spinning while the owner is OFFPROC is idiocy.
       // Consider: ctr -= RunnablePenalty ;
       if (Knob_OState && NotRunnable (Self, ox)) {
-         TEVENT (Spin abort - notrunnable);
-         goto Abort ;
+         TEVENT(Spin abort - notrunnable);
+         goto Abort;
       }
-      if (sss && _succ == NULL ) _succ = Self ;
+      if (sss && _succ == NULL) _succ = Self;
    }
 
    // Spin failed with prejudice -- reduce _SpinDuration.
    // TODO: Use an AIMD-like policy to adjust _SpinDuration.
    // AIMD is globally stable.
-   TEVENT (Spin failure) ;
+   TEVENT(Spin failure);
    {
-     int x = _SpinDuration ;
+     int x = _SpinDuration;
      if (x > 0) {
         // Consider an AIMD scheme like: x -= (x >> 3) + 100
         // This is globally sample and tends to damp the response.
-        x -= Knob_Penalty ;
-        if (x < 0) x = 0 ;
-        _SpinDuration = x ;
+        x -= Knob_Penalty;
+        if (x < 0) x = 0;
+        _SpinDuration = x;
      }
    }
 
  Abort:
-   if (MaxSpin >= 0) Adjust (&_Spinner, -1) ;
+   if (MaxSpin >= 0) Adjust(&_Spinner, -1);
    if (sss && _succ == Self) {
-      _succ = NULL ;
+      _succ = NULL;
       // Invariant: after setting succ=null a contending thread
       // must recheck-retry _owner before parking.  This usually happens
       // in the normal usage of TrySpin(), but it's safest
       // to make TrySpin() as foolproof as possible.
-      OrderAccess::fence() ;
-      if (TryLock(Self) > 0) return 1 ;
+      OrderAccess::fence();
+      if (TryLock(Self) > 0) return 1;
    }
-   return 0 ;
+   return 0;
 }
 
 // NotRunnable() -- informed spinning
@@ -2240,9 +2240,9 @@
 
 int ObjectMonitor::NotRunnable (Thread * Self, Thread * ox) {
     // Check either OwnerIsThread or ox->TypeTag == 2BAD.
-    if (!OwnerIsThread) return 0 ;
+    if (!OwnerIsThread) return 0;
 
-    if (ox == NULL) return 0 ;
+    if (ox == NULL) return 0;
 
     // Avoid transitive spinning ...
     // Say T1 spins or blocks trying to acquire L.  T1._Stalled is set to L.
@@ -2251,17 +2251,17 @@
     // This occurs transiently after T1 acquired L but before
     // T1 managed to clear T1.Stalled.  T2 does not need to abort
     // its spin in this circumstance.
-    intptr_t BlockedOn = SafeFetchN ((intptr_t *) &ox->_Stalled, intptr_t(1)) ;
+    intptr_t BlockedOn = SafeFetchN((intptr_t *) &ox->_Stalled, intptr_t(1));
 
-    if (BlockedOn == 1) return 1 ;
+    if (BlockedOn == 1) return 1;
     if (BlockedOn != 0) {
-      return BlockedOn != intptr_t(this) && _owner == ox ;
+      return BlockedOn != intptr_t(this) && _owner == ox;
     }
 
-    assert (sizeof(((JavaThread *)ox)->_thread_state == sizeof(int)), "invariant") ;
-    int jst = SafeFetch32 ((int *) &((JavaThread *) ox)->_thread_state, -1) ; ;
+    assert(sizeof(((JavaThread *)ox)->_thread_state == sizeof(int)), "invariant");
+    int jst = SafeFetch32((int *) &((JavaThread *) ox)->_thread_state, -1);;
     // consider also: jst != _thread_in_Java -- but that's overspecific.
-    return jst == _thread_blocked || jst == _thread_in_native ;
+    return jst == _thread_blocked || jst == _thread_in_native;
 }
 
 
@@ -2272,11 +2272,11 @@
   _next     = NULL;
   _prev     = NULL;
   _notified = 0;
-  TState    = TS_RUN ;
+  TState    = TS_RUN;
   _thread   = thread;
-  _event    = thread->_ParkEvent ;
+  _event    = thread->_ParkEvent;
   _active   = false;
-  assert (_event != NULL, "invariant") ;
+  assert(_event != NULL, "invariant");
 }
 
 void ObjectWaiter::wait_reenter_begin(ObjectMonitor *mon) {
@@ -2299,7 +2299,7 @@
     node->_prev = node;
     node->_next = node;
   } else {
-    ObjectWaiter* head = _WaitSet ;
+    ObjectWaiter* head = _WaitSet;
     ObjectWaiter* tail = head->_prev;
     assert(tail->_next == head, "invariant check");
     tail->_next = node;
@@ -2345,56 +2345,56 @@
 
 // -----------------------------------------------------------------------------
 // PerfData support
-PerfCounter * ObjectMonitor::_sync_ContendedLockAttempts       = NULL ;
-PerfCounter * ObjectMonitor::_sync_FutileWakeups               = NULL ;
-PerfCounter * ObjectMonitor::_sync_Parks                       = NULL ;
-PerfCounter * ObjectMonitor::_sync_EmptyNotifications          = NULL ;
-PerfCounter * ObjectMonitor::_sync_Notifications               = NULL ;
-PerfCounter * ObjectMonitor::_sync_PrivateA                    = NULL ;
-PerfCounter * ObjectMonitor::_sync_PrivateB                    = NULL ;
-PerfCounter * ObjectMonitor::_sync_SlowExit                    = NULL ;
-PerfCounter * ObjectMonitor::_sync_SlowEnter                   = NULL ;
-PerfCounter * ObjectMonitor::_sync_SlowNotify                  = NULL ;
-PerfCounter * ObjectMonitor::_sync_SlowNotifyAll               = NULL ;
-PerfCounter * ObjectMonitor::_sync_FailedSpins                 = NULL ;
-PerfCounter * ObjectMonitor::_sync_SuccessfulSpins             = NULL ;
-PerfCounter * ObjectMonitor::_sync_MonInCirculation            = NULL ;
-PerfCounter * ObjectMonitor::_sync_MonScavenged                = NULL ;
-PerfCounter * ObjectMonitor::_sync_Inflations                  = NULL ;
-PerfCounter * ObjectMonitor::_sync_Deflations                  = NULL ;
-PerfLongVariable * ObjectMonitor::_sync_MonExtant              = NULL ;
+PerfCounter * ObjectMonitor::_sync_ContendedLockAttempts       = NULL;
+PerfCounter * ObjectMonitor::_sync_FutileWakeups               = NULL;
+PerfCounter * ObjectMonitor::_sync_Parks                       = NULL;
+PerfCounter * ObjectMonitor::_sync_EmptyNotifications          = NULL;
+PerfCounter * ObjectMonitor::_sync_Notifications               = NULL;
+PerfCounter * ObjectMonitor::_sync_PrivateA                    = NULL;
+PerfCounter * ObjectMonitor::_sync_PrivateB                    = NULL;
+PerfCounter * ObjectMonitor::_sync_SlowExit                    = NULL;
+PerfCounter * ObjectMonitor::_sync_SlowEnter                   = NULL;
+PerfCounter * ObjectMonitor::_sync_SlowNotify                  = NULL;
+PerfCounter * ObjectMonitor::_sync_SlowNotifyAll               = NULL;
+PerfCounter * ObjectMonitor::_sync_FailedSpins                 = NULL;
+PerfCounter * ObjectMonitor::_sync_SuccessfulSpins             = NULL;
+PerfCounter * ObjectMonitor::_sync_MonInCirculation            = NULL;
+PerfCounter * ObjectMonitor::_sync_MonScavenged                = NULL;
+PerfCounter * ObjectMonitor::_sync_Inflations                  = NULL;
+PerfCounter * ObjectMonitor::_sync_Deflations                  = NULL;
+PerfLongVariable * ObjectMonitor::_sync_MonExtant              = NULL;
 
 // One-shot global initialization for the sync subsystem.
 // We could also defer initialization and initialize on-demand
 // the first time we call inflate().  Initialization would
 // be protected - like so many things - by the MonitorCache_lock.
 
-void ObjectMonitor::Initialize () {
-  static int InitializationCompleted = 0 ;
-  assert (InitializationCompleted == 0, "invariant") ;
-  InitializationCompleted = 1 ;
+void ObjectMonitor::Initialize() {
+  static int InitializationCompleted = 0;
+  assert(InitializationCompleted == 0, "invariant");
+  InitializationCompleted = 1;
   if (UsePerfData) {
-      EXCEPTION_MARK ;
+      EXCEPTION_MARK;
       #define NEWPERFCOUNTER(n)   {n = PerfDataManager::create_counter(SUN_RT, #n, PerfData::U_Events,CHECK); }
       #define NEWPERFVARIABLE(n)  {n = PerfDataManager::create_variable(SUN_RT, #n, PerfData::U_Events,CHECK); }
-      NEWPERFCOUNTER(_sync_Inflations) ;
-      NEWPERFCOUNTER(_sync_Deflations) ;
-      NEWPERFCOUNTER(_sync_ContendedLockAttempts) ;
-      NEWPERFCOUNTER(_sync_FutileWakeups) ;
-      NEWPERFCOUNTER(_sync_Parks) ;
-      NEWPERFCOUNTER(_sync_EmptyNotifications) ;
-      NEWPERFCOUNTER(_sync_Notifications) ;
-      NEWPERFCOUNTER(_sync_SlowEnter) ;
-      NEWPERFCOUNTER(_sync_SlowExit) ;
-      NEWPERFCOUNTER(_sync_SlowNotify) ;
-      NEWPERFCOUNTER(_sync_SlowNotifyAll) ;
-      NEWPERFCOUNTER(_sync_FailedSpins) ;
-      NEWPERFCOUNTER(_sync_SuccessfulSpins) ;
-      NEWPERFCOUNTER(_sync_PrivateA) ;
-      NEWPERFCOUNTER(_sync_PrivateB) ;
-      NEWPERFCOUNTER(_sync_MonInCirculation) ;
-      NEWPERFCOUNTER(_sync_MonScavenged) ;
-      NEWPERFVARIABLE(_sync_MonExtant) ;
+      NEWPERFCOUNTER(_sync_Inflations);
+      NEWPERFCOUNTER(_sync_Deflations);
+      NEWPERFCOUNTER(_sync_ContendedLockAttempts);
+      NEWPERFCOUNTER(_sync_FutileWakeups);
+      NEWPERFCOUNTER(_sync_Parks);
+      NEWPERFCOUNTER(_sync_EmptyNotifications);
+      NEWPERFCOUNTER(_sync_Notifications);
+      NEWPERFCOUNTER(_sync_SlowEnter);
+      NEWPERFCOUNTER(_sync_SlowExit);
+      NEWPERFCOUNTER(_sync_SlowNotify);
+      NEWPERFCOUNTER(_sync_SlowNotifyAll);
+      NEWPERFCOUNTER(_sync_FailedSpins);
+      NEWPERFCOUNTER(_sync_SuccessfulSpins);
+      NEWPERFCOUNTER(_sync_PrivateA);
+      NEWPERFCOUNTER(_sync_PrivateB);
+      NEWPERFCOUNTER(_sync_MonInCirculation);
+      NEWPERFCOUNTER(_sync_MonScavenged);
+      NEWPERFVARIABLE(_sync_MonExtant);
       #undef NEWPERFCOUNTER
   }
 }
@@ -2414,33 +2414,33 @@
 
 
 static char * kvGet (char * kvList, const char * Key) {
-    if (kvList == NULL) return NULL ;
-    size_t n = strlen (Key) ;
-    char * Search ;
-    for (Search = kvList ; *Search ; Search += strlen(Search) + 1) {
+    if (kvList == NULL) return NULL;
+    size_t n = strlen(Key);
+    char * Search;
+    for (Search = kvList; *Search; Search += strlen(Search) + 1) {
         if (strncmp (Search, Key, n) == 0) {
-            if (Search[n] == '=') return Search + n + 1 ;
-            if (Search[n] == 0)   return (char *) "1" ;
+            if (Search[n] == '=') return Search + n + 1;
+            if (Search[n] == 0)   return(char *) "1";
         }
     }
-    return NULL ;
+    return NULL;
 }
 
 static int kvGetInt (char * kvList, const char * Key, int Default) {
-    char * v = kvGet (kvList, Key) ;
-    int rslt = v ? ::strtol (v, NULL, 0) : Default ;
+    char * v = kvGet(kvList, Key);
+    int rslt = v ? ::strtol(v, NULL, 0) : Default;
     if (Knob_ReportSettings && v != NULL) {
         ::printf ("  SyncKnob: %s %d(%d)\n", Key, rslt, Default) ;
-        ::fflush (stdout) ;
+        ::fflush(stdout);
     }
-    return rslt ;
+    return rslt;
 }
 
-void ObjectMonitor::DeferredInitialize () {
-  if (InitDone > 0) return ;
+void ObjectMonitor::DeferredInitialize() {
+  if (InitDone > 0) return;
   if (Atomic::cmpxchg (-1, &InitDone, 0) != 0) {
-      while (InitDone != 1) ;
-      return ;
+      while (InitDone != 1);
+      return;
   }
 
   // One-shot global initialization ...
@@ -2449,68 +2449,68 @@
   // SyncKnobs consist of <Key>=<Value> pairs in the style
   // of environment variables.  Start by converting ':' to NUL.
 
-  if (SyncKnobs == NULL) SyncKnobs = "" ;
+  if (SyncKnobs == NULL) SyncKnobs = "";
 
-  size_t sz = strlen (SyncKnobs) ;
-  char * knobs = (char *) malloc (sz + 2) ;
+  size_t sz = strlen(SyncKnobs);
+  char * knobs = (char *) malloc(sz + 2);
   if (knobs == NULL) {
-     vm_exit_out_of_memory (sz + 2, OOM_MALLOC_ERROR, "Parse SyncKnobs") ;
-     guarantee (0, "invariant") ;
+     vm_exit_out_of_memory(sz + 2, OOM_MALLOC_ERROR, "Parse SyncKnobs");
+     guarantee(0, "invariant");
   }
-  strcpy (knobs, SyncKnobs) ;
-  knobs[sz+1] = 0 ;
-  for (char * p = knobs ; *p ; p++) {
-     if (*p == ':') *p = 0 ;
+  strcpy(knobs, SyncKnobs);
+  knobs[sz+1] = 0;
+  for (char * p = knobs; *p; p++) {
+     if (*p == ':') *p = 0;
   }
 
   #define SETKNOB(x) { Knob_##x = kvGetInt (knobs, #x, Knob_##x); }
-  SETKNOB(ReportSettings) ;
-  SETKNOB(Verbose) ;
-  SETKNOB(FixedSpin) ;
-  SETKNOB(SpinLimit) ;
-  SETKNOB(SpinBase) ;
+  SETKNOB(ReportSettings);
+  SETKNOB(Verbose);
+  SETKNOB(FixedSpin);
+  SETKNOB(SpinLimit);
+  SETKNOB(SpinBase);
   SETKNOB(SpinBackOff);
-  SETKNOB(CASPenalty) ;
-  SETKNOB(OXPenalty) ;
-  SETKNOB(LogSpins) ;
-  SETKNOB(SpinSetSucc) ;
-  SETKNOB(SuccEnabled) ;
-  SETKNOB(SuccRestrict) ;
-  SETKNOB(Penalty) ;
-  SETKNOB(Bonus) ;
-  SETKNOB(BonusB) ;
-  SETKNOB(Poverty) ;
-  SETKNOB(SpinAfterFutile) ;
-  SETKNOB(UsePause) ;
-  SETKNOB(SpinEarly) ;
-  SETKNOB(OState) ;
-  SETKNOB(MaxSpinners) ;
-  SETKNOB(PreSpin) ;
-  SETKNOB(ExitPolicy) ;
+  SETKNOB(CASPenalty);
+  SETKNOB(OXPenalty);
+  SETKNOB(LogSpins);
+  SETKNOB(SpinSetSucc);
+  SETKNOB(SuccEnabled);
+  SETKNOB(SuccRestrict);
+  SETKNOB(Penalty);
+  SETKNOB(Bonus);
+  SETKNOB(BonusB);
+  SETKNOB(Poverty);
+  SETKNOB(SpinAfterFutile);
+  SETKNOB(UsePause);
+  SETKNOB(SpinEarly);
+  SETKNOB(OState);
+  SETKNOB(MaxSpinners);
+  SETKNOB(PreSpin);
+  SETKNOB(ExitPolicy);
   SETKNOB(QMode);
-  SETKNOB(ResetEvent) ;
-  SETKNOB(MoveNotifyee) ;
-  SETKNOB(FastHSSEC) ;
+  SETKNOB(ResetEvent);
+  SETKNOB(MoveNotifyee);
+  SETKNOB(FastHSSEC);
   #undef SETKNOB
 
   if (os::is_MP()) {
-     BackOffMask = (1 << Knob_SpinBackOff) - 1 ;
-     if (Knob_ReportSettings) ::printf ("BackOffMask=%X\n", BackOffMask) ;
+     BackOffMask = (1 << Knob_SpinBackOff) - 1;
+     if (Knob_ReportSettings) ::printf("BackOffMask=%X\n", BackOffMask);
      // CONSIDER: BackOffMask = ROUNDUP_NEXT_POWER2 (ncpus-1)
   } else {
-     Knob_SpinLimit = 0 ;
-     Knob_SpinBase  = 0 ;
-     Knob_PreSpin   = 0 ;
-     Knob_FixedSpin = -1 ;
+     Knob_SpinLimit = 0;
+     Knob_SpinBase  = 0;
+     Knob_PreSpin   = 0;
+     Knob_FixedSpin = -1;
   }
 
   if (Knob_LogSpins == 0) {
-     ObjectMonitor::_sync_FailedSpins = NULL ;
+     ObjectMonitor::_sync_FailedSpins = NULL;
   }
 
-  free (knobs) ;
-  OrderAccess::fence() ;
-  InitDone = 1 ;
+  free(knobs);
+  OrderAccess::fence();
+  InitDone = 1;
 }
 
 #ifndef PRODUCT
--- a/hotspot/src/share/vm/runtime/objectMonitor.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/objectMonitor.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -37,17 +37,17 @@
 
 class ObjectWaiter : public StackObj {
  public:
-  enum TStates { TS_UNDEF, TS_READY, TS_RUN, TS_WAIT, TS_ENTER, TS_CXQ } ;
-  enum Sorted  { PREPEND, APPEND, SORTED } ;
+  enum TStates { TS_UNDEF, TS_READY, TS_RUN, TS_WAIT, TS_ENTER, TS_CXQ };
+  enum Sorted  { PREPEND, APPEND, SORTED };
   ObjectWaiter * volatile _next;
   ObjectWaiter * volatile _prev;
   Thread*       _thread;
   jlong         _notifier_tid;
   ParkEvent *   _event;
-  volatile int  _notified ;
-  volatile TStates TState ;
-  Sorted        _Sorted ;           // List placement disposition
-  bool          _active ;           // Contention monitoring is enabled
+  volatile int  _notified;
+  volatile TStates TState;
+  Sorted        _Sorted;           // List placement disposition
+  bool          _active;           // Contention monitoring is enabled
  public:
   ObjectWaiter(Thread* thread);
 
@@ -92,19 +92,19 @@
   static int owner_offset_in_bytes()       { return offset_of(ObjectMonitor, _owner);      }
   static int count_offset_in_bytes()       { return offset_of(ObjectMonitor, _count);      }
   static int recursions_offset_in_bytes()  { return offset_of(ObjectMonitor, _recursions); }
-  static int cxq_offset_in_bytes()         { return offset_of(ObjectMonitor, _cxq) ;       }
-  static int succ_offset_in_bytes()        { return offset_of(ObjectMonitor, _succ) ;      }
+  static int cxq_offset_in_bytes()         { return offset_of(ObjectMonitor, _cxq);       }
+  static int succ_offset_in_bytes()        { return offset_of(ObjectMonitor, _succ);      }
   static int EntryList_offset_in_bytes()   { return offset_of(ObjectMonitor, _EntryList);  }
   static int FreeNext_offset_in_bytes()    { return offset_of(ObjectMonitor, FreeNext);    }
-  static int WaitSet_offset_in_bytes()     { return offset_of(ObjectMonitor, _WaitSet) ;   }
-  static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible);}
+  static int WaitSet_offset_in_bytes()     { return offset_of(ObjectMonitor, _WaitSet);   }
+  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 ;
+  static int (*SpinCallbackFunction)(intptr_t, int);
+  static intptr_t SpinCallbackArgument;
 
 
  public:
@@ -115,7 +115,7 @@
     // TODO-FIXME: merge _count and _waiters.
     // TODO-FIXME: assert _owner == null implies _recursions = 0
     // TODO-FIXME: assert _WaitSet != null implies _count > 0
-    return _count|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList ) ;
+    return _count|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList);
   }
 
   intptr_t  is_entered(Thread* current) const;
@@ -127,7 +127,7 @@
 
   intptr_t  count() const;
   void      set_count(intptr_t count);
-  intptr_t  contentions() const ;
+  intptr_t  contentions() const;
   intptr_t  recursions() const                                         { return _recursions; }
 
   // JVM/DI GetMonitorInfo() needs this
@@ -145,15 +145,15 @@
     _object       = NULL;
     _owner        = NULL;
     _WaitSet      = NULL;
-    _WaitSetLock  = 0 ;
-    _Responsible  = NULL ;
-    _succ         = NULL ;
-    _cxq          = NULL ;
-    FreeNext      = NULL ;
-    _EntryList    = NULL ;
-    _SpinFreq     = 0 ;
-    _SpinClock    = 0 ;
-    OwnerIsThread = 0 ;
+    _WaitSetLock  = 0;
+    _Responsible  = NULL;
+    _succ         = NULL;
+    _cxq          = NULL;
+    FreeNext      = NULL;
+    _EntryList    = NULL;
+    _SpinFreq     = 0;
+    _SpinClock    = 0;
+    OwnerIsThread = 0;
     _previous_owner_tid = 0;
   }
 
@@ -164,20 +164,20 @@
   }
 
 private:
-  void Recycle () {
+  void Recycle() {
     // TODO: add stronger asserts ...
     // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
     // _count == 0 EntryList  == NULL
     // _recursions == 0 _WaitSet == NULL
     // TODO: assert (is_busy()|_recursions) == 0
-    _succ          = NULL ;
-    _EntryList     = NULL ;
-    _cxq           = NULL ;
-    _WaitSet       = NULL ;
-    _recursions    = 0 ;
-    _SpinFreq      = 0 ;
-    _SpinClock     = 0 ;
-    OwnerIsThread  = 0 ;
+    _succ          = NULL;
+    _EntryList     = NULL;
+    _cxq           = NULL;
+    _WaitSet       = NULL;
+    _recursions    = 0;
+    _SpinFreq      = 0;
+    _SpinClock     = 0;
+    OwnerIsThread  = 0;
   }
 
 public:
@@ -194,7 +194,7 @@
   void      print();
 #endif
 
-  bool      try_enter (TRAPS) ;
+  bool      try_enter(TRAPS);
   void      enter(TRAPS);
   void      exit(bool not_suspended, TRAPS);
   void      wait(jlong millis, bool interruptable, TRAPS);
@@ -206,22 +206,22 @@
   void      reenter(intptr_t recursions, TRAPS);
 
  private:
-  void      AddWaiter (ObjectWaiter * waiter) ;
+  void      AddWaiter(ObjectWaiter * waiter);
   static    void DeferredInitialize();
 
-  ObjectWaiter * DequeueWaiter () ;
-  void      DequeueSpecificWaiter (ObjectWaiter * waiter) ;
-  void      EnterI (TRAPS) ;
-  void      ReenterI (Thread * Self, ObjectWaiter * SelfNode) ;
-  void      UnlinkAfterAcquire (Thread * Self, ObjectWaiter * SelfNode) ;
-  int       TryLock (Thread * Self) ;
-  int       NotRunnable (Thread * Self, Thread * Owner) ;
-  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) ;
+  ObjectWaiter * DequeueWaiter();
+  void      DequeueSpecificWaiter(ObjectWaiter * waiter);
+  void      EnterI(TRAPS);
+  void      ReenterI(Thread * Self, ObjectWaiter * SelfNode);
+  void      UnlinkAfterAcquire(Thread * Self, ObjectWaiter * SelfNode);
+  int       TryLock(Thread * Self);
+  int       NotRunnable(Thread * Self, Thread * Owner);
+  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,
                                                    jlong notifier_tid,
                                                    jlong timeout,
@@ -240,7 +240,7 @@
   volatile markOop   _header;       // displaced object header word - mark
   void*     volatile _object;       // backward object pointer - strong root
 
-  double SharingPad [1] ;           // temp to reduce false sharing
+  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
@@ -251,22 +251,22 @@
   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.
+  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.
+  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
+  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
+  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
@@ -284,30 +284,30 @@
   volatile int _WaitSetLock;        // protects Wait Queue - simple spinlock
 
  public:
-  int _QMix ;                       // Mixed prepend queue discipline
-  ObjectMonitor * FreeNext ;        // Free list linkage
-  intptr_t StatA, StatsB ;
+  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 ;
+  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;
@@ -329,7 +329,7 @@
 #undef TEVENT
 #define TEVENT(nom) {if (SyncVerbose) FEVENT(nom); }
 
-#define FEVENT(nom) { static volatile int ctr = 0 ; int v = ++ctr ; if ((v & (v-1)) == 0) { ::printf (#nom " : %d \n", v); ::fflush(stdout); }}
+#define FEVENT(nom) { static volatile int ctr = 0; int v = ++ctr; if ((v & (v-1)) == 0) { ::printf (#nom " : %d \n", v); ::fflush(stdout); }}
 
 #undef  TEVENT
 #define TEVENT(nom) {;}
--- a/hotspot/src/share/vm/runtime/os.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/os.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -32,6 +32,9 @@
 #include "gc_implementation/shared/vmGCOperations.hpp"
 #include "interpreter/interpreter.hpp"
 #include "memory/allocation.inline.hpp"
+#ifdef ASSERT
+#include "memory/guardedMemory.hpp"
+#endif
 #include "oops/oop.inline.hpp"
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
@@ -523,121 +526,20 @@
 }
 
 
-
-#ifdef ASSERT
-#define space_before             (MallocCushion + sizeof(double))
-#define space_after              MallocCushion
-#define size_addr_from_base(p)   (size_t*)(p + space_before - sizeof(size_t))
-#define size_addr_from_obj(p)    ((size_t*)p - 1)
-// MallocCushion: size of extra cushion allocated around objects with +UseMallocOnly
-// NB: cannot be debug variable, because these aren't set from the command line until
-// *after* the first few allocs already happened
-#define MallocCushion            16
-#else
-#define space_before             0
-#define space_after              0
-#define size_addr_from_base(p)   should not use w/o ASSERT
-#define size_addr_from_obj(p)    should not use w/o ASSERT
-#define MallocCushion            0
-#endif
 #define paranoid                 0  /* only set to 1 if you suspect checking code has bug */
 
 #ifdef ASSERT
-inline size_t get_size(void* obj) {
-  size_t size = *size_addr_from_obj(obj);
-  if (size < 0) {
-    fatal(err_msg("free: size field of object #" PTR_FORMAT " was overwritten ("
-                  SIZE_FORMAT ")", obj, size));
-  }
-  return size;
-}
 
-u_char* find_cushion_backwards(u_char* start) {
-  u_char* p = start;
-  while (p[ 0] != badResourceValue || p[-1] != badResourceValue ||
-         p[-2] != badResourceValue || p[-3] != badResourceValue) p--;
-  // ok, we have four consecutive marker bytes; find start
-  u_char* q = p - 4;
-  while (*q == badResourceValue) q--;
-  return q + 1;
-}
-
-u_char* find_cushion_forwards(u_char* start) {
-  u_char* p = start;
-  while (p[0] != badResourceValue || p[1] != badResourceValue ||
-         p[2] != badResourceValue || p[3] != badResourceValue) p++;
-  // ok, we have four consecutive marker bytes; find end of cushion
-  u_char* q = p + 4;
-  while (*q == badResourceValue) q++;
-  return q - MallocCushion;
-}
-
-void print_neighbor_blocks(void* ptr) {
-  // find block allocated before ptr (not entirely crash-proof)
-  if (MallocCushion < 4) {
-    tty->print_cr("### cannot find previous block (MallocCushion < 4)");
-    return;
-  }
-  u_char* start_of_this_block = (u_char*)ptr - space_before;
-  u_char* end_of_prev_block_data = start_of_this_block - space_after -1;
-  // look for cushion in front of prev. block
-  u_char* start_of_prev_block = find_cushion_backwards(end_of_prev_block_data);
-  ptrdiff_t size = *size_addr_from_base(start_of_prev_block);
-  u_char* obj = start_of_prev_block + space_before;
-  if (size <= 0 ) {
-    // start is bad; may have been confused by OS data in between objects
-    // search one more backwards
-    start_of_prev_block = find_cushion_backwards(start_of_prev_block);
-    size = *size_addr_from_base(start_of_prev_block);
-    obj = start_of_prev_block + space_before;
-  }
-
-  if (start_of_prev_block + space_before + size + space_after == start_of_this_block) {
-    tty->print_cr("### previous object: " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", obj, size);
-  } else {
-    tty->print_cr("### previous object (not sure if correct): " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", obj, size);
-  }
-
-  // now find successor block
-  u_char* start_of_next_block = (u_char*)ptr + *size_addr_from_obj(ptr) + space_after;
-  start_of_next_block = find_cushion_forwards(start_of_next_block);
-  u_char* next_obj = start_of_next_block + space_before;
-  ptrdiff_t next_size = *size_addr_from_base(start_of_next_block);
-  if (start_of_next_block[0] == badResourceValue &&
-      start_of_next_block[1] == badResourceValue &&
-      start_of_next_block[2] == badResourceValue &&
-      start_of_next_block[3] == badResourceValue) {
-    tty->print_cr("### next object: " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", next_obj, next_size);
-  } else {
-    tty->print_cr("### next object (not sure if correct): " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", next_obj, next_size);
+static void verify_memory(void* ptr) {
+  GuardedMemory guarded(ptr);
+  if (!guarded.verify_guards()) {
+    tty->print_cr("## nof_mallocs = " UINT64_FORMAT ", nof_frees = " UINT64_FORMAT, os::num_mallocs, os::num_frees);
+    tty->print_cr("## memory stomp:");
+    guarded.print_on(tty);
+    fatal("memory stomping error");
   }
 }
 
-
-void report_heap_error(void* memblock, void* bad, const char* where) {
-  tty->print_cr("## nof_mallocs = " UINT64_FORMAT ", nof_frees = " UINT64_FORMAT, os::num_mallocs, os::num_frees);
-  tty->print_cr("## memory stomp: byte at " PTR_FORMAT " %s object " PTR_FORMAT, bad, where, memblock);
-  print_neighbor_blocks(memblock);
-  fatal("memory stomping error");
-}
-
-void verify_block(void* memblock) {
-  size_t size = get_size(memblock);
-  if (MallocCushion) {
-    u_char* ptr = (u_char*)memblock - space_before;
-    for (int i = 0; i < MallocCushion; i++) {
-      if (ptr[i] != badResourceValue) {
-        report_heap_error(memblock, ptr+i, "in front of");
-      }
-    }
-    u_char* end = (u_char*)memblock + size + space_after;
-    for (int j = -MallocCushion; j < 0; j++) {
-      if (end[j] != badResourceValue) {
-        report_heap_error(memblock, end+j, "after");
-      }
-    }
-  }
-}
 #endif
 
 //
@@ -686,16 +588,18 @@
     size = 1;
   }
 
-  const size_t alloc_size = size + space_before + space_after;
-
+#ifndef ASSERT
+  const size_t alloc_size = size;
+#else
+  const size_t alloc_size = GuardedMemory::get_total_size(size);
   if (size > alloc_size) { // Check for rollover.
     return NULL;
   }
+#endif
 
   NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
 
   u_char* ptr;
-
   if (MallocMaxTestWords > 0) {
     ptr = testMalloc(alloc_size);
   } else {
@@ -703,28 +607,26 @@
   }
 
 #ifdef ASSERT
-  if (ptr == NULL) return NULL;
-  if (MallocCushion) {
-    for (u_char* p = ptr; p < ptr + MallocCushion; p++) *p = (u_char)badResourceValue;
-    u_char* end = ptr + space_before + size;
-    for (u_char* pq = ptr+MallocCushion; pq < end; pq++) *pq = (u_char)uninitBlockPad;
-    for (u_char* q = end; q < end + MallocCushion; q++) *q = (u_char)badResourceValue;
+  if (ptr == NULL) {
+    return NULL;
   }
-  // put size just before data
-  *size_addr_from_base(ptr) = size;
+  // Wrap memory with guard
+  GuardedMemory guarded(ptr, size);
+  ptr = guarded.get_user_ptr();
 #endif
-  u_char* memblock = ptr + space_before;
-  if ((intptr_t)memblock == (intptr_t)MallocCatchPtr) {
-    tty->print_cr("os::malloc caught, " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, memblock);
+  if ((intptr_t)ptr == (intptr_t)MallocCatchPtr) {
+    tty->print_cr("os::malloc caught, " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, ptr);
     breakpoint();
   }
-  debug_only(if (paranoid) verify_block(memblock));
-  if (PrintMalloc && tty != NULL) tty->print_cr("os::malloc " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, memblock);
+  debug_only(if (paranoid) verify_memory(ptr));
+  if (PrintMalloc && tty != NULL) {
+    tty->print_cr("os::malloc " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, ptr);
+  }
 
-  // we do not track MallocCushion memory
-    MemTracker::record_malloc((address)memblock, size, memflags, caller == 0 ? CALLER_PC : caller);
+  // we do not track guard memory
+  MemTracker::record_malloc((address)ptr, size, memflags, caller == 0 ? CALLER_PC : caller);
 
-  return memblock;
+  return ptr;
 }
 
 
@@ -743,27 +645,32 @@
   return ptr;
 #else
   if (memblock == NULL) {
-    return malloc(size, memflags, (caller == 0 ? CALLER_PC : caller));
+    return os::malloc(size, memflags, (caller == 0 ? CALLER_PC : caller));
   }
   if ((intptr_t)memblock == (intptr_t)MallocCatchPtr) {
     tty->print_cr("os::realloc caught " PTR_FORMAT, memblock);
     breakpoint();
   }
-  verify_block(memblock);
+  verify_memory(memblock);
   NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
-  if (size == 0) return NULL;
+  if (size == 0) {
+    return NULL;
+  }
   // always move the block
-  void* ptr = malloc(size, memflags, caller == 0 ? CALLER_PC : caller);
-  if (PrintMalloc) tty->print_cr("os::remalloc " SIZE_FORMAT " bytes, " PTR_FORMAT " --> " PTR_FORMAT, size, memblock, ptr);
+  void* ptr = os::malloc(size, memflags, caller == 0 ? CALLER_PC : caller);
+  if (PrintMalloc) {
+    tty->print_cr("os::remalloc " SIZE_FORMAT " bytes, " PTR_FORMAT " --> " PTR_FORMAT, size, memblock, ptr);
+  }
   // Copy to new memory if malloc didn't fail
   if ( ptr != NULL ) {
-    memcpy(ptr, memblock, MIN2(size, get_size(memblock)));
-    if (paranoid) verify_block(ptr);
+    GuardedMemory guarded(memblock);
+    memcpy(ptr, memblock, MIN2(size, guarded.get_user_size()));
+    if (paranoid) verify_memory(ptr);
     if ((intptr_t)ptr == (intptr_t)MallocCatchPtr) {
       tty->print_cr("os::realloc caught, " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, ptr);
       breakpoint();
     }
-    free(memblock);
+    os::free(memblock);
   }
   return ptr;
 #endif
@@ -771,6 +678,7 @@
 
 
 void  os::free(void *memblock, MEMFLAGS memflags) {
+  address trackp = (address) memblock;
   NOT_PRODUCT(inc_stat_counter(&num_frees, 1));
 #ifdef ASSERT
   if (memblock == NULL) return;
@@ -778,34 +686,20 @@
     if (tty != NULL) tty->print_cr("os::free caught " PTR_FORMAT, memblock);
     breakpoint();
   }
-  verify_block(memblock);
+  verify_memory(memblock);
   NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
-  // Added by detlefs.
-  if (MallocCushion) {
-    u_char* ptr = (u_char*)memblock - space_before;
-    for (u_char* p = ptr; p < ptr + MallocCushion; p++) {
-      guarantee(*p == badResourceValue,
-                "Thing freed should be malloc result.");
-      *p = (u_char)freeBlockPad;
-    }
-    size_t size = get_size(memblock);
-    inc_stat_counter(&free_bytes, size);
-    u_char* end = ptr + space_before + size;
-    for (u_char* q = end; q < end + MallocCushion; q++) {
-      guarantee(*q == badResourceValue,
-                "Thing freed should be malloc result.");
-      *q = (u_char)freeBlockPad;
-    }
-    if (PrintMalloc && tty != NULL)
+
+  GuardedMemory guarded(memblock);
+  size_t size = guarded.get_user_size();
+  inc_stat_counter(&free_bytes, size);
+  memblock = guarded.release_for_freeing();
+  if (PrintMalloc && tty != NULL) {
       fprintf(stderr, "os::free " SIZE_FORMAT " bytes --> " PTR_FORMAT "\n", size, (uintptr_t)memblock);
-  } else if (PrintMalloc && tty != NULL) {
-    // tty->print_cr("os::free %p", memblock);
-    fprintf(stderr, "os::free " PTR_FORMAT "\n", (uintptr_t)memblock);
   }
 #endif
-  MemTracker::record_free((address)memblock, memflags);
+  MemTracker::record_free(trackp, memflags);
 
-  ::free((char*)memblock - space_before);
+  ::free(memblock);
 }
 
 void os::init_random(long initval) {
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -410,49 +410,6 @@
 }
 
 
-bool Reflection::reflect_check_access(Klass* field_class, AccessFlags acc, Klass* target_class, bool is_method_invoke, TRAPS) {
-  // field_class  : declaring class
-  // acc          : declared field access
-  // target_class : for protected
-
-  // Check if field or method is accessible to client.  Throw an
-  // IllegalAccessException and return false if not.
-
-  // The "client" is the class associated with the nearest real frame
-  // getCallerClass already skips Method.invoke frames, so pass 0 in
-  // that case (same as classic).
-  ResourceMark rm(THREAD);
-  assert(THREAD->is_Java_thread(), "sanity check");
-  Klass* client_class = ((JavaThread *)THREAD)->security_get_caller_class(is_method_invoke ? 0 : 1);
-
-  if (client_class != field_class) {
-    if (!verify_class_access(client_class, field_class, false)
-        || !verify_field_access(client_class,
-                                field_class,
-                                field_class,
-                                acc,
-                                false)) {
-      THROW_(vmSymbols::java_lang_IllegalAccessException(), false);
-    }
-  }
-
-  // Additional test for protected members: JLS 6.6.2
-
-  if (acc.is_protected()) {
-    if (target_class != client_class) {
-      if (!is_same_class_package(client_class, field_class)) {
-        if (!target_class->is_subclass_of(client_class)) {
-          THROW_(vmSymbols::java_lang_IllegalAccessException(), false);
-        }
-      }
-    }
-  }
-
-  // Passed all tests
-  return true;
-}
-
-
 bool Reflection::verify_class_access(Klass* current_class, Klass* new_class, bool classloader_only) {
   // Verify that current_class can access new_class.  If the classloader_only
   // flag is set, we automatically allow any accesses in which current_class
@@ -463,10 +420,9 @@
       is_same_class_package(current_class, new_class)) {
     return true;
   }
-  // New (1.4) reflection implementation. Allow all accesses from
-  // sun/reflect/MagicAccessorImpl subclasses to succeed trivially.
-  if (   JDK_Version::is_gte_jdk14x_version()
-      && current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
+  // Allow all accesses from sun/reflect/MagicAccessorImpl subclasses to
+  // succeed trivially.
+  if (current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
     return true;
   }
 
@@ -567,10 +523,9 @@
     return true;
   }
 
-  // New (1.4) reflection implementation. Allow all accesses from
-  // sun/reflect/MagicAccessorImpl subclasses to succeed trivially.
-  if (   JDK_Version::is_gte_jdk14x_version()
-      && current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
+  // Allow all accesses from sun/reflect/MagicAccessorImpl subclasses to
+  // succeed trivially.
+  if (current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
     return true;
   }
 
@@ -707,12 +662,10 @@
 
 
 oop Reflection::new_method(methodHandle method, bool for_constant_pool_access, TRAPS) {
-  // In jdk1.2.x, getMethods on an interface erroneously includes <clinit>, thus the complicated assert.
-  // Also allow sun.reflect.ConstantPool to refer to <clinit> methods as java.lang.reflect.Methods.
+  // Allow sun.reflect.ConstantPool to refer to <clinit> methods as java.lang.reflect.Methods.
   assert(!method()->is_initializer() ||
-         (for_constant_pool_access && method()->is_static()) ||
-         (method()->name() == vmSymbols::class_initializer_name()
-    && method()->method_holder()->is_interface() && JDK_Version::is_jdk12x_version()), "should call new_constructor instead");
+         (for_constant_pool_access && method()->is_static()),
+         "should call new_constructor instead");
   instanceKlassHandle holder (THREAD, method->method_holder());
   int slot = method->method_idnum();
 
@@ -978,22 +931,6 @@
                                                         reflected_method->signature()));
   }
 
-  // In the JDK 1.4 reflection implementation, the security check is
-  // done at the Java level
-  if (!JDK_Version::is_gte_jdk14x_version()) {
-
-  // Access checking (unless overridden by Method)
-  if (!override) {
-    if (!(klass->is_public() && reflected_method->is_public())) {
-      bool access = Reflection::reflect_check_access(klass(), reflected_method->access_flags(), target_klass(), is_method_invoke, CHECK_NULL);
-      if (!access) {
-        return NULL; // exception
-      }
-    }
-  }
-
-  } // !Universe::is_gte_jdk14x_version()
-
   assert(ptypes->is_objArray(), "just checking");
   int args_len = args.is_null() ? 0 : args->length();
   // Check number of arguments
--- a/hotspot/src/share/vm/runtime/reflection.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/reflection.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -44,9 +44,6 @@
 
 class Reflection: public AllStatic {
  private:
-  // Access checking
-  static bool reflect_check_access(Klass* field_class, AccessFlags acc, Klass* target_class, bool is_method_invoke, TRAPS);
-
   // Conversion
   static Klass* basic_type_mirror_to_arrayklass(oop basic_type_mirror, TRAPS);
   static oop      basic_type_arrayklass_to_mirror(Klass* basic_type_arrayklass, TRAPS);
--- a/hotspot/src/share/vm/runtime/reflectionUtils.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/reflectionUtils.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,15 +76,10 @@
   int offset;
   offset = java_lang_Throwable::get_backtrace_offset();
   _filtered_fields->append(new FilteredField(SystemDictionary::Throwable_klass(), offset));
-  // The latest version of vm may be used with old jdk.
-  if (JDK_Version::is_gte_jdk16x_version()) {
-    // The following class fields do not exist in
-    // previous version of jdk.
-    offset = sun_reflect_ConstantPool::oop_offset();
-    _filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset));
-    offset = sun_reflect_UnsafeStaticFieldAccessorImpl::base_offset();
-    _filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset));
-  }
+  offset = sun_reflect_ConstantPool::oop_offset();
+  _filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset));
+  offset = sun_reflect_UnsafeStaticFieldAccessorImpl::base_offset();
+  _filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset));
 }
 
 int FilteredFieldStream::field_count() {
--- a/hotspot/src/share/vm/runtime/serviceThread.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/serviceThread.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,8 +41,7 @@
   instanceKlassHandle klass (THREAD,  SystemDictionary::Thread_klass());
   instanceHandle thread_oop = klass->allocate_instance_handle(CHECK);
 
-  const char* name = JDK_Version::is_gte_jdk17x_version() ?
-      "Service Thread" : "Low Memory Detector";
+  const char* name = "Service Thread";
 
   Handle string = java_lang_String::create_from_str(name, CHECK);
 
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -198,13 +198,13 @@
 
 void SharedRuntime::print_ic_miss_histogram() {
   if (ICMissHistogram) {
-    tty->print_cr ("IC Miss Histogram:");
+    tty->print_cr("IC Miss Histogram:");
     int tot_misses = 0;
     for (int i = 0; i < _ICmiss_index; i++) {
       tty->print_cr("  at: " INTPTR_FORMAT "  nof: %d", _ICmiss_at[i], _ICmiss_count[i]);
       tot_misses += _ICmiss_count[i];
     }
-    tty->print_cr ("Total IC misses: %7d", tot_misses);
+    tty->print_cr("Total IC misses: %7d", tot_misses);
   }
 }
 #endif // PRODUCT
@@ -266,7 +266,7 @@
   xbits.f = x;
   ybits.f = y;
   // x Mod Infinity == x unless x is infinity
-  if ( ((xbits.i & float_sign_mask) != float_infinity) &&
+  if (((xbits.i & float_sign_mask) != float_infinity) &&
        ((ybits.i & float_sign_mask) == float_infinity) ) {
     return x;
   }
@@ -281,7 +281,7 @@
   xbits.d = x;
   ybits.d = y;
   // x Mod Infinity == x unless x is infinity
-  if ( ((xbits.l & double_sign_mask) != double_infinity) &&
+  if (((xbits.l & double_sign_mask) != double_infinity) &&
        ((ybits.l & double_sign_mask) == double_infinity) ) {
     return x;
   }
@@ -537,13 +537,13 @@
   CodeBlob *cb = CodeCache::find_blob(pc);
 
   // Should be an nmethod
-  assert( cb && cb->is_nmethod(), "safepoint polling: pc must refer to an nmethod" );
+  assert(cb && cb->is_nmethod(), "safepoint polling: pc must refer to an nmethod");
 
   // Look up the relocation information
-  assert( ((nmethod*)cb)->is_at_poll_or_poll_return(pc),
-    "safepoint polling: type must be poll" );
-
-  assert( ((NativeInstruction*)pc)->is_safepoint_poll(),
+  assert(((nmethod*)cb)->is_at_poll_or_poll_return(pc),
+    "safepoint polling: type must be poll");
+
+  assert(((NativeInstruction*)pc)->is_safepoint_poll(),
     "Only polling locations are used for safepoint");
 
   bool at_poll_return = ((nmethod*)cb)->is_at_poll_return(pc);
@@ -562,7 +562,7 @@
     stub = SharedRuntime::polling_page_safepoint_handler_blob()->entry_point();
   }
 #ifndef PRODUCT
-  if( TraceSafepoint ) {
+  if (TraceSafepoint) {
     char buf[256];
     jio_snprintf(buf, sizeof(buf),
                  "... found polling page %s exception at pc = "
@@ -1474,7 +1474,7 @@
         should_be_mono = true;
       } else if (inline_cache->is_icholder_call()) {
         CompiledICHolder* ic_oop = inline_cache->cached_icholder();
-        if ( ic_oop != NULL) {
+        if (ic_oop != NULL) {
 
           if (receiver()->klass() == ic_oop->holder_klass()) {
             // This isn't a real miss. We must have seen that compiled code
@@ -1728,7 +1728,7 @@
       iter.next();
       assert(iter.has_current(), "must have a reloc at java call site");
       relocInfo::relocType typ = iter.reloc()->type();
-      if ( typ != relocInfo::static_call_type &&
+      if (typ != relocInfo::static_call_type &&
            typ != relocInfo::opt_virtual_call_type &&
            typ != relocInfo::static_stub_type) {
         return;
@@ -1784,7 +1784,7 @@
   // The copy_array mechanism is awkward and could be removed, but
   // the compilers don't call this function except as a last resort,
   // so it probably doesn't matter.
-  src->klass()->copy_array((arrayOopDesc*)src,  src_pos,
+  src->klass()->copy_array((arrayOopDesc*)src, src_pos,
                                         (arrayOopDesc*)dest, dest_pos,
                                         length, thread);
 }
@@ -1891,8 +1891,8 @@
   ttyLocker ttyl;
   if (xtty != NULL)  xtty->head("statistics type='SharedRuntime'");
 
-  if (_monitor_enter_ctr ) tty->print_cr("%5d monitor enter slow",  _monitor_enter_ctr);
-  if (_monitor_exit_ctr  ) tty->print_cr("%5d monitor exit slow",   _monitor_exit_ctr);
+  if (_monitor_enter_ctr) tty->print_cr("%5d monitor enter slow",  _monitor_enter_ctr);
+  if (_monitor_exit_ctr) tty->print_cr("%5d monitor exit slow",   _monitor_exit_ctr);
   if (_throw_null_ctr) tty->print_cr("%5d implicit null throw", _throw_null_ctr);
 
   SharedRuntime::print_ic_miss_histogram();
@@ -1905,36 +1905,36 @@
   }
 
   // Dump the JRT_ENTRY counters
-  if( _new_instance_ctr ) tty->print_cr("%5d new instance requires GC", _new_instance_ctr);
-  if( _new_array_ctr ) tty->print_cr("%5d new array requires GC", _new_array_ctr);
-  if( _multi1_ctr ) tty->print_cr("%5d multianewarray 1 dim", _multi1_ctr);
-  if( _multi2_ctr ) tty->print_cr("%5d multianewarray 2 dim", _multi2_ctr);
-  if( _multi3_ctr ) tty->print_cr("%5d multianewarray 3 dim", _multi3_ctr);
-  if( _multi4_ctr ) tty->print_cr("%5d multianewarray 4 dim", _multi4_ctr);
-  if( _multi5_ctr ) tty->print_cr("%5d multianewarray 5 dim", _multi5_ctr);
-
-  tty->print_cr("%5d inline cache miss in compiled", _ic_miss_ctr );
-  tty->print_cr("%5d wrong method", _wrong_method_ctr );
-  tty->print_cr("%5d unresolved static call site", _resolve_static_ctr );
-  tty->print_cr("%5d unresolved virtual call site", _resolve_virtual_ctr );
-  tty->print_cr("%5d unresolved opt virtual call site", _resolve_opt_virtual_ctr );
-
-  if( _mon_enter_stub_ctr ) tty->print_cr("%5d monitor enter stub", _mon_enter_stub_ctr );
-  if( _mon_exit_stub_ctr ) tty->print_cr("%5d monitor exit stub", _mon_exit_stub_ctr );
-  if( _mon_enter_ctr ) tty->print_cr("%5d monitor enter slow", _mon_enter_ctr );
-  if( _mon_exit_ctr ) tty->print_cr("%5d monitor exit slow", _mon_exit_ctr );
-  if( _partial_subtype_ctr) tty->print_cr("%5d slow partial subtype", _partial_subtype_ctr );
-  if( _jbyte_array_copy_ctr ) tty->print_cr("%5d byte array copies", _jbyte_array_copy_ctr );
-  if( _jshort_array_copy_ctr ) tty->print_cr("%5d short array copies", _jshort_array_copy_ctr );
-  if( _jint_array_copy_ctr ) tty->print_cr("%5d int array copies", _jint_array_copy_ctr );
-  if( _jlong_array_copy_ctr ) tty->print_cr("%5d long array copies", _jlong_array_copy_ctr );
-  if( _oop_array_copy_ctr ) tty->print_cr("%5d oop array copies", _oop_array_copy_ctr );
-  if( _checkcast_array_copy_ctr ) tty->print_cr("%5d checkcast array copies", _checkcast_array_copy_ctr );
-  if( _unsafe_array_copy_ctr ) tty->print_cr("%5d unsafe array copies", _unsafe_array_copy_ctr );
-  if( _generic_array_copy_ctr ) tty->print_cr("%5d generic array copies", _generic_array_copy_ctr );
-  if( _slow_array_copy_ctr ) tty->print_cr("%5d slow array copies", _slow_array_copy_ctr );
-  if( _find_handler_ctr ) tty->print_cr("%5d find exception handler", _find_handler_ctr );
-  if( _rethrow_ctr ) tty->print_cr("%5d rethrow handler", _rethrow_ctr );
+  if (_new_instance_ctr) tty->print_cr("%5d new instance requires GC", _new_instance_ctr);
+  if (_new_array_ctr) tty->print_cr("%5d new array requires GC", _new_array_ctr);
+  if (_multi1_ctr) tty->print_cr("%5d multianewarray 1 dim", _multi1_ctr);
+  if (_multi2_ctr) tty->print_cr("%5d multianewarray 2 dim", _multi2_ctr);
+  if (_multi3_ctr) tty->print_cr("%5d multianewarray 3 dim", _multi3_ctr);
+  if (_multi4_ctr) tty->print_cr("%5d multianewarray 4 dim", _multi4_ctr);
+  if (_multi5_ctr) tty->print_cr("%5d multianewarray 5 dim", _multi5_ctr);
+
+  tty->print_cr("%5d inline cache miss in compiled", _ic_miss_ctr);
+  tty->print_cr("%5d wrong method", _wrong_method_ctr);
+  tty->print_cr("%5d unresolved static call site", _resolve_static_ctr);
+  tty->print_cr("%5d unresolved virtual call site", _resolve_virtual_ctr);
+  tty->print_cr("%5d unresolved opt virtual call site", _resolve_opt_virtual_ctr);
+
+  if (_mon_enter_stub_ctr) tty->print_cr("%5d monitor enter stub", _mon_enter_stub_ctr);
+  if (_mon_exit_stub_ctr) tty->print_cr("%5d monitor exit stub", _mon_exit_stub_ctr);
+  if (_mon_enter_ctr) tty->print_cr("%5d monitor enter slow", _mon_enter_ctr);
+  if (_mon_exit_ctr) tty->print_cr("%5d monitor exit slow", _mon_exit_ctr);
+  if (_partial_subtype_ctr) tty->print_cr("%5d slow partial subtype", _partial_subtype_ctr);
+  if (_jbyte_array_copy_ctr) tty->print_cr("%5d byte array copies", _jbyte_array_copy_ctr);
+  if (_jshort_array_copy_ctr) tty->print_cr("%5d short array copies", _jshort_array_copy_ctr);
+  if (_jint_array_copy_ctr) tty->print_cr("%5d int array copies", _jint_array_copy_ctr);
+  if (_jlong_array_copy_ctr) tty->print_cr("%5d long array copies", _jlong_array_copy_ctr);
+  if (_oop_array_copy_ctr) tty->print_cr("%5d oop array copies", _oop_array_copy_ctr);
+  if (_checkcast_array_copy_ctr) tty->print_cr("%5d checkcast array copies", _checkcast_array_copy_ctr);
+  if (_unsafe_array_copy_ctr) tty->print_cr("%5d unsafe array copies", _unsafe_array_copy_ctr);
+  if (_generic_array_copy_ctr) tty->print_cr("%5d generic array copies", _generic_array_copy_ctr);
+  if (_slow_array_copy_ctr) tty->print_cr("%5d slow array copies", _slow_array_copy_ctr);
+  if (_find_handler_ctr) tty->print_cr("%5d find exception handler", _find_handler_ctr);
+  if (_rethrow_ctr) tty->print_cr("%5d rethrow handler", _rethrow_ctr);
 
   AdapterHandlerLibrary::print_statistics();
 
@@ -1997,7 +1997,7 @@
   MethodArityHistogram() {
     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     _max_arity = _max_size = 0;
-    for (int i = 0; i < MAX_ARITY; i++) _arity_histogram[i] = _size_histogram [i] = 0;
+    for (int i = 0; i < MAX_ARITY; i++) _arity_histogram[i] = _size_histogram[i] = 0;
     CodeCache::nmethods_do(add_method_to_histogram);
     print_histogram();
   }
@@ -2062,7 +2062,7 @@
   // These are correct for the current system but someday it might be
   // necessary to make this mapping platform dependent.
   static int adapter_encoding(BasicType in) {
-    switch(in) {
+    switch (in) {
       case T_BOOLEAN:
       case T_BYTE:
       case T_SHORT:
@@ -2479,7 +2479,7 @@
       tty->print_cr("i2c argument handler #%d for: %s %s (%d bytes generated)",
                     _adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"),
                     method->signature()->as_C_string(), insts_size);
-      tty->print_cr("c2i argument handler starts at %p",entry->get_c2i_entry());
+      tty->print_cr("c2i argument handler starts at %p", entry->get_c2i_entry());
       if (Verbose || PrintStubCode) {
         address first_pc = entry->base_address();
         if (first_pc != NULL) {
@@ -2504,7 +2504,7 @@
                  new_adapter->name(),
                  fingerprint->as_string(),
                  new_adapter->content_begin());
-    Forte::register_stub(blob_id, new_adapter->content_begin(),new_adapter->content_end());
+    Forte::register_stub(blob_id, new_adapter->content_begin(), new_adapter->content_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
       JvmtiExport::post_dynamic_code_generated(blob_id, new_adapter->content_begin(), new_adapter->content_end());
@@ -2605,12 +2605,12 @@
       BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
       VMRegPair*   regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
       int i=0;
-      if( !method->is_static() )  // Pass in receiver first
+      if (!method->is_static())  // Pass in receiver first
         sig_bt[i++] = T_OBJECT;
       SignatureStream ss(method->signature());
-      for( ; !ss.at_return_type(); ss.next()) {
+      for (; !ss.at_return_type(); ss.next()) {
         sig_bt[i++] = ss.type();  // Collect remaining bits of signature
-        if( ss.type() == T_LONG || ss.type() == T_DOUBLE )
+        if (ss.type() == T_LONG || ss.type() == T_DOUBLE)
           sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
       }
       assert(i == total_args_passed, "");
@@ -2762,10 +2762,10 @@
         case T_SHORT:
         case T_INT:
           // Convert (bt) to (T_LONG,bt).
-          new_in_sig_bt[argcnt  ] = T_LONG;
+          new_in_sig_bt[argcnt] = T_LONG;
           new_in_sig_bt[argcnt+1] = bt;
           assert(reg.first()->is_valid() && !reg.second()->is_valid(), "");
-          new_in_regs[argcnt  ].set2(reg.first());
+          new_in_regs[argcnt].set2(reg.first());
           new_in_regs[argcnt+1].set_bad();
           argcnt++;
           break;
@@ -2808,17 +2808,17 @@
   int len = (int)strlen(s);
   s++; len--;                   // Skip opening paren
   char *t = s+len;
-  while( *(--t) != ')' ) ;      // Find close paren
-
-  BasicType *sig_bt = NEW_RESOURCE_ARRAY( BasicType, 256 );
-  VMRegPair *regs = NEW_RESOURCE_ARRAY( VMRegPair, 256 );
+  while (*(--t) != ')');      // Find close paren
+
+  BasicType *sig_bt = NEW_RESOURCE_ARRAY(BasicType, 256);
+  VMRegPair *regs = NEW_RESOURCE_ARRAY(VMRegPair, 256);
   int cnt = 0;
   if (has_receiver) {
     sig_bt[cnt++] = T_OBJECT; // Receiver is argument 0; not in signature
   }
 
-  while( s < t ) {
-    switch( *s++ ) {            // Switch on signature character
+  while (s < t) {
+    switch (*s++) {            // Switch on signature character
     case 'B': sig_bt[cnt++] = T_BYTE;    break;
     case 'C': sig_bt[cnt++] = T_CHAR;    break;
     case 'D': sig_bt[cnt++] = T_DOUBLE;  sig_bt[cnt++] = T_VOID; break;
@@ -2829,16 +2829,16 @@
     case 'Z': sig_bt[cnt++] = T_BOOLEAN; break;
     case 'V': sig_bt[cnt++] = T_VOID;    break;
     case 'L':                   // Oop
-      while( *s++ != ';'  ) ;   // Skip signature
+      while (*s++ != ';');   // Skip signature
       sig_bt[cnt++] = T_OBJECT;
       break;
     case '[': {                 // Array
       do {                      // Skip optional size
-        while( *s >= '0' && *s <= '9' ) s++;
-      } while( *s++ == '[' );   // Nested arrays?
+        while (*s >= '0' && *s <= '9') s++;
+      } while (*s++ == '[');   // Nested arrays?
       // Skip element type
-      if( s[-1] == 'L' )
-        while( *s++ != ';'  ) ; // Skip signature
+      if (s[-1] == 'L')
+        while (*s++ != ';'); // Skip signature
       sig_bt[cnt++] = T_ARRAY;
       break;
     }
@@ -2850,7 +2850,7 @@
     sig_bt[cnt++] = T_OBJECT;
   }
 
-  assert( cnt < 256, "grow table size" );
+  assert(cnt < 256, "grow table size");
 
   int comp_args_on_stack;
   comp_args_on_stack = java_calling_convention(sig_bt, regs, cnt, true);
@@ -2861,12 +2861,12 @@
   if (comp_args_on_stack) {
     for (int i = 0; i < cnt; i++) {
       VMReg reg1 = regs[i].first();
-      if( reg1->is_stack()) {
+      if (reg1->is_stack()) {
         // Yuck
         reg1 = reg1->bias(out_preserve_stack_slots());
       }
       VMReg reg2 = regs[i].second();
-      if( reg2->is_stack()) {
+      if (reg2->is_stack()) {
         // Yuck
         reg2 = reg2->bias(out_preserve_stack_slots());
       }
@@ -2904,15 +2904,15 @@
   // frame accessor methods and be platform independent.
 
   frame fr = thread->last_frame();
-  assert( fr.is_interpreted_frame(), "" );
-  assert( fr.interpreter_frame_expression_stack_size()==0, "only handle empty stacks" );
+  assert(fr.is_interpreted_frame(), "");
+  assert(fr.interpreter_frame_expression_stack_size()==0, "only handle empty stacks");
 
   // Figure out how many monitors are active.
   int active_monitor_count = 0;
-  for( BasicObjectLock *kptr = fr.interpreter_frame_monitor_end();
+  for (BasicObjectLock *kptr = fr.interpreter_frame_monitor_end();
        kptr < fr.interpreter_frame_monitor_begin();
        kptr = fr.next_monitor_in_interpreter_frame(kptr) ) {
-    if( kptr->obj() != NULL ) active_monitor_count++;
+    if (kptr->obj() != NULL) active_monitor_count++;
   }
 
   // QQQ we could place number of active monitors in the array so that compiled code
@@ -2926,17 +2926,17 @@
 
   // Copy the locals.  Order is preserved so that loading of longs works.
   // Since there's no GC I can copy the oops blindly.
-  assert( sizeof(HeapWord)==sizeof(intptr_t), "fix this code");
+  assert(sizeof(HeapWord)==sizeof(intptr_t), "fix this code");
   Copy::disjoint_words((HeapWord*)fr.interpreter_frame_local_at(max_locals-1),
                        (HeapWord*)&buf[0],
                        max_locals);
 
   // Inflate locks.  Copy the displaced headers.  Be careful, there can be holes.
   int i = max_locals;
-  for( BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
+  for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
        kptr2 < fr.interpreter_frame_monitor_begin();
        kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
-    if( kptr2->obj() != NULL) {         // Avoid 'holes' in the monitor array
+    if (kptr2->obj() != NULL) {         // Avoid 'holes' in the monitor array
       BasicLock *lock = kptr2->lock();
       // Inflate so the displaced header becomes position-independent
       if (lock->displaced_header()->is_unlocked())
@@ -2946,20 +2946,20 @@
       buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
     }
   }
-  assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" );
+  assert(i - max_locals == active_monitor_count*2, "found the expected number of monitors");
 
   return buf;
 JRT_END
 
 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
-  FREE_C_HEAP_ARRAY(intptr_t,buf, mtCode);
+  FREE_C_HEAP_ARRAY(intptr_t, buf, mtCode);
 JRT_END
 
 bool AdapterHandlerLibrary::contains(CodeBlob* b) {
   AdapterHandlerTableIterator iter(_adapters);
   while (iter.has_next()) {
     AdapterHandlerEntry* a = iter.next();
-    if ( b == CodeCache::find_blob(a->get_i2c_entry()) ) return true;
+    if (b == CodeCache::find_blob(a->get_i2c_entry())) return true;
   }
   return false;
 }
--- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -217,7 +217,7 @@
   static UncommonTrapBlob* uncommon_trap_blob()                  { return _uncommon_trap_blob; }
 #endif // COMPILER2
 
-  static address get_resolve_opt_virtual_call_stub(){
+  static address get_resolve_opt_virtual_call_stub() {
     assert(_resolve_opt_virtual_call_blob != NULL, "oops");
     return _resolve_opt_virtual_call_blob->entry_point();
   }
@@ -253,7 +253,7 @@
   // bytecode tracing is only used by the TraceBytecodes
   static intptr_t trace_bytecode(JavaThread* thread, intptr_t preserve_this_value, intptr_t tos, intptr_t tos2) PRODUCT_RETURN0;
 
-  static oop retrieve_receiver( Symbol* sig, frame caller );
+  static oop retrieve_receiver(Symbol* sig, frame caller);
 
   static void register_finalizer(JavaThread* thread, oopDesc* obj);
 
@@ -446,8 +446,8 @@
   static bool is_wide_vector(int size);
 
   // Save and restore a native result
-  static void    save_native_result(MacroAssembler *_masm, BasicType ret_type, int frame_slots );
-  static void restore_native_result(MacroAssembler *_masm, BasicType ret_type, int frame_slots );
+  static void    save_native_result(MacroAssembler *_masm, BasicType ret_type, int frame_slots);
+  static void restore_native_result(MacroAssembler *_masm, BasicType ret_type, int frame_slots);
 
   // Generate a native wrapper for a given method.  The method takes arguments
   // in the Java compiled code convention, marshals them to the native
@@ -463,7 +463,7 @@
                                           int compile_id,
                                           BasicType* sig_bt,
                                           VMRegPair* regs,
-                                          BasicType ret_type );
+                                          BasicType ret_type);
 
   // Block before entering a JNI critical method
   static void block_for_jni_critical(JavaThread* thread);
--- a/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -26,6 +26,7 @@
 #include "prims/jni.h"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/sharedRuntime.hpp"
+#include "runtime/sharedRuntimeMath.hpp"
 
 // This file contains copies of the fdlibm routines used by
 // StrictMath. It turns out that it is almost always required to use
@@ -36,35 +37,6 @@
 // pointer out to libjava.so in SharedRuntime speeds these routines up
 // by roughly 15% on both Win32/x86 and Solaris/SPARC.
 
-// Enabling optimizations in this file causes incorrect code to be
-// generated; can not figure out how to turn down optimization for one
-// file in the IDE on Windows
-#ifdef WIN32
-# pragma optimize ( "", off )
-#endif
-
-/* The above workaround now causes more problems with the latest MS compiler.
- * Visual Studio 2010's /GS option tries to guard against buffer overruns.
- * /GS is on by default if you specify optimizations, which we do globally
- * via /W3 /O2. However the above selective turning off of optimizations means
- * that /GS issues a warning "4748". And since we treat warnings as errors (/WX)
- * then the compilation fails. There are several possible solutions
- * (1) Remove that pragma above as obsolete with VS2010 - requires testing.
- * (2) Stop treating warnings as errors - would be a backward step
- * (3) Disable /GS - may help performance but you lose the security checks
- * (4) Disable the warning with "#pragma warning( disable : 4748 )"
- * (5) Disable planting the code with  __declspec(safebuffers)
- * I've opted for (5) although we should investigate the local performance
- * benefits of (1) and global performance benefit of (3).
- */
-#if defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1600))
-#define SAFEBUF __declspec(safebuffers)
-#else
-#define SAFEBUF
-#endif
-
-#include "runtime/sharedRuntimeMath.hpp"
-
 /*
  * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2)
  * double x[],y[]; int e0,nx,prec; int ipio2[];
@@ -201,7 +173,7 @@
 two24B  = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */
 twon24  = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */
 
-static SAFEBUF int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int *ipio2) {
+static int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int *ipio2) {
   int jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
   double z,fw,f[20],fq[20],q[20];
 
@@ -417,7 +389,7 @@
 pio2_3  =  2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
 pio2_3t =  8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
 
-static SAFEBUF int __ieee754_rem_pio2(double x, double *y) {
+static int __ieee754_rem_pio2(double x, double *y) {
   double z,w,t,r,fn;
   double tx[3];
   int e0,i,j,nx,n,ix,hx,i0;
@@ -916,8 +888,3 @@
                                                      -1 -- n odd */
   }
 JRT_END
-
-
-#ifdef WIN32
-# pragma optimize ( "", on )
-#endif
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -120,15 +120,15 @@
 }
 
 #define NINFLATIONLOCKS 256
-static volatile intptr_t InflationLocks [NINFLATIONLOCKS] ;
+static volatile intptr_t InflationLocks[NINFLATIONLOCKS];
 
-ObjectMonitor * ObjectSynchronizer::gBlockList = NULL ;
-ObjectMonitor * volatile ObjectSynchronizer::gFreeList  = NULL ;
-ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList  = NULL ;
+ObjectMonitor * ObjectSynchronizer::gBlockList = NULL;
+ObjectMonitor * volatile ObjectSynchronizer::gFreeList  = NULL;
+ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList  = NULL;
 int ObjectSynchronizer::gOmInUseCount = 0;
-static volatile intptr_t ListLock = 0 ;      // protects global monitor free-list cache
-static volatile int MonitorFreeCount  = 0 ;      // # on gFreeList
-static volatile int MonitorPopulation = 0 ;      // # Extant -- in circulation
+static volatile intptr_t ListLock = 0;      // protects global monitor free-list cache
+static volatile int MonitorFreeCount  = 0;      // # on gFreeList
+static volatile int MonitorPopulation = 0;      // # Extant -- in circulation
 #define CHAINMARKER (cast_to_oop<intptr_t>(-1))
 
 // -----------------------------------------------------------------------------
@@ -152,43 +152,43 @@
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
  }
 
- slow_enter (obj, lock, THREAD) ;
+ slow_enter(obj, lock, THREAD);
 }
 
 void ObjectSynchronizer::fast_exit(oop object, BasicLock* lock, TRAPS) {
   assert(!object->mark()->has_bias_pattern(), "should not see bias pattern here");
   // if displaced header is null, the previous enter is recursive enter, no-op
   markOop dhw = lock->displaced_header();
-  markOop mark ;
+  markOop mark;
   if (dhw == NULL) {
      // Recursive stack-lock.
      // Diagnostics -- Could be: stack-locked, inflating, inflated.
-     mark = object->mark() ;
-     assert (!mark->is_neutral(), "invariant") ;
+     mark = object->mark();
+     assert(!mark->is_neutral(), "invariant");
      if (mark->has_locker() && mark != markOopDesc::INFLATING()) {
-        assert(THREAD->is_lock_owned((address)mark->locker()), "invariant") ;
+        assert(THREAD->is_lock_owned((address)mark->locker()), "invariant");
      }
      if (mark->has_monitor()) {
-        ObjectMonitor * m = mark->monitor() ;
-        assert(((oop)(m->object()))->mark() == mark, "invariant") ;
-        assert(m->is_entered(THREAD), "invariant") ;
+        ObjectMonitor * m = mark->monitor();
+        assert(((oop)(m->object()))->mark() == mark, "invariant");
+        assert(m->is_entered(THREAD), "invariant");
      }
-     return ;
+     return;
   }
 
-  mark = object->mark() ;
+  mark = object->mark();
 
   // If the object is stack-locked by the current thread, try to
   // swing the displaced header from the box back to the mark.
   if (mark == (markOop) lock) {
-     assert (dhw->is_neutral(), "invariant") ;
+     assert(dhw->is_neutral(), "invariant");
      if ((markOop) Atomic::cmpxchg_ptr (dhw, object->mark_addr(), mark) == mark) {
-        TEVENT (fast_exit: release stacklock) ;
+        TEVENT(fast_exit: release stacklock);
         return;
      }
   }
 
-  ObjectSynchronizer::inflate(THREAD, object)->exit (true, THREAD) ;
+  ObjectSynchronizer::inflate(THREAD, object)->exit(true, THREAD);
 }
 
 // -----------------------------------------------------------------------------
@@ -205,8 +205,8 @@
     // be visible <= the ST performed by the CAS.
     lock->set_displaced_header(mark);
     if (mark == (markOop) Atomic::cmpxchg_ptr(lock, obj()->mark_addr(), mark)) {
-      TEVENT (slow_enter: release stacklock) ;
-      return ;
+      TEVENT(slow_enter: release stacklock);
+      return;
     }
     // Fall through to inflate() ...
   } else
@@ -220,8 +220,8 @@
 #if 0
   // The following optimization isn't particularly useful.
   if (mark->has_monitor() && mark->monitor()->is_entered(THREAD)) {
-    lock->set_displaced_header (NULL) ;
-    return ;
+    lock->set_displaced_header(NULL);
+    return;
   }
 #endif
 
@@ -238,7 +238,7 @@
 // failed in the interpreter/compiler code. Simply use the heavy
 // weight monitor should be ok, unless someone find otherwise.
 void ObjectSynchronizer::slow_exit(oop object, BasicLock* lock, TRAPS) {
-  fast_exit (object, lock, THREAD) ;
+  fast_exit(object, lock, THREAD);
 }
 
 // -----------------------------------------------------------------------------
@@ -254,7 +254,7 @@
 //  5) lock lock2
 // NOTE: must use heavy weight monitor to handle complete_exit/reenter()
 intptr_t ObjectSynchronizer::complete_exit(Handle obj, TRAPS) {
-  TEVENT (complete_exit) ;
+  TEVENT(complete_exit);
   if (UseBiasedLocking) {
     BiasedLocking::revoke_and_rebias(obj, false, THREAD);
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
@@ -267,7 +267,7 @@
 
 // NOTE: must use heavy weight monitor to handle complete_exit/reenter()
 void ObjectSynchronizer::reenter(Handle obj, intptr_t recursion, TRAPS) {
-  TEVENT (reenter) ;
+  TEVENT(reenter);
   if (UseBiasedLocking) {
     BiasedLocking::revoke_and_rebias(obj, false, THREAD);
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
@@ -282,7 +282,7 @@
 // NOTE: must use heavy weight monitor to handle jni monitor enter
 void ObjectSynchronizer::jni_enter(Handle obj, TRAPS) { // possible entry from jni enter
   // the current locking is from JNI instead of Java code
-  TEVENT (jni_enter) ;
+  TEVENT(jni_enter);
   if (UseBiasedLocking) {
     BiasedLocking::revoke_and_rebias(obj, false, THREAD);
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
@@ -306,7 +306,7 @@
 
 // NOTE: must use heavy weight monitor to handle jni monitor exit
 void ObjectSynchronizer::jni_exit(oop obj, Thread* THREAD) {
-  TEVENT (jni_exit) ;
+  TEVENT(jni_exit);
   if (UseBiasedLocking) {
     Handle h_obj(THREAD, obj);
     BiasedLocking::revoke_and_rebias(h_obj, false, THREAD);
@@ -332,7 +332,7 @@
   _obj = obj;
 
   if (_dolock) {
-    TEVENT (ObjectLocker) ;
+    TEVENT(ObjectLocker);
 
     ObjectSynchronizer::fast_enter(_obj, &_lock, false, _thread);
   }
@@ -354,7 +354,7 @@
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
   }
   if (millis < 0) {
-    TEVENT (wait - throw IAX) ;
+    TEVENT(wait - throw IAX);
     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative");
   }
   ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj());
@@ -374,10 +374,10 @@
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
   }
   if (millis < 0) {
-    TEVENT (wait - throw IAX) ;
+    TEVENT(wait - throw IAX);
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative");
   }
-  ObjectSynchronizer::inflate(THREAD, obj()) -> wait(millis, false, THREAD) ;
+  ObjectSynchronizer::inflate(THREAD, obj()) -> wait(millis, false, THREAD);
 }
 
 void ObjectSynchronizer::notify(Handle obj, TRAPS) {
@@ -428,31 +428,31 @@
 struct SharedGlobals {
     // These are highly shared mostly-read variables.
     // To avoid false-sharing they need to be the sole occupants of a $ line.
-    double padPrefix [8];
-    volatile int stwRandom ;
-    volatile int stwCycle ;
+    double padPrefix[8];
+    volatile int stwRandom;
+    volatile int stwCycle;
 
     // Hot RW variables -- Sequester to avoid false-sharing
-    double padSuffix [16];
-    volatile int hcSequence ;
-    double padFinal [8] ;
-} ;
+    double padSuffix[16];
+    volatile int hcSequence;
+    double padFinal[8];
+};
 
-static SharedGlobals GVars ;
-static int MonitorScavengeThreshold = 1000000 ;
-static volatile int ForceMonitorScavenge = 0 ; // Scavenge required and pending
+static SharedGlobals GVars;
+static int MonitorScavengeThreshold = 1000000;
+static volatile int ForceMonitorScavenge = 0; // Scavenge required and pending
 
 static markOop ReadStableMark (oop obj) {
-  markOop mark = obj->mark() ;
+  markOop mark = obj->mark();
   if (!mark->is_being_inflated()) {
-    return mark ;       // normal fast-path return
+    return mark;       // normal fast-path return
   }
 
-  int its = 0 ;
+  int its = 0;
   for (;;) {
-    markOop mark = obj->mark() ;
+    markOop mark = obj->mark();
     if (!mark->is_being_inflated()) {
-      return mark ;    // normal fast-path return
+      return mark;    // normal fast-path return
     }
 
     // The object is being inflated by some other thread.
@@ -465,11 +465,11 @@
     // TODO: add inflation contention performance counters.
     // TODO: restrict the aggregate number of spinners.
 
-    ++its ;
+    ++its;
     if (its > 10000 || !os::is_MP()) {
        if (its & 1) {
-         os::NakedYield() ;
-         TEVENT (Inflate: INFLATING - yield) ;
+         os::NakedYield();
+         TEVENT(Inflate: INFLATING - yield);
        } else {
          // Note that the following code attenuates the livelock problem but is not
          // a complete remedy.  A more complete solution would require that the inflating
@@ -486,26 +486,26 @@
          // then for each thread on the list, set the flag and unpark() the thread.
          // This is conceptually similar to muxAcquire-muxRelease, except that muxRelease
          // wakes at most one thread whereas we need to wake the entire list.
-         int ix = (cast_from_oop<intptr_t>(obj) >> 5) & (NINFLATIONLOCKS-1) ;
-         int YieldThenBlock = 0 ;
-         assert (ix >= 0 && ix < NINFLATIONLOCKS, "invariant") ;
-         assert ((NINFLATIONLOCKS & (NINFLATIONLOCKS-1)) == 0, "invariant") ;
-         Thread::muxAcquire (InflationLocks + ix, "InflationLock") ;
+         int ix = (cast_from_oop<intptr_t>(obj) >> 5) & (NINFLATIONLOCKS-1);
+         int YieldThenBlock = 0;
+         assert(ix >= 0 && ix < NINFLATIONLOCKS, "invariant");
+         assert((NINFLATIONLOCKS & (NINFLATIONLOCKS-1)) == 0, "invariant");
+         Thread::muxAcquire(InflationLocks + ix, "InflationLock");
          while (obj->mark() == markOopDesc::INFLATING()) {
            // Beware: NakedYield() is advisory and has almost no effect on some platforms
            // so we periodically call Self->_ParkEvent->park(1).
            // We use a mixed spin/yield/block mechanism.
            if ((YieldThenBlock++) >= 16) {
-              Thread::current()->_ParkEvent->park(1) ;
+              Thread::current()->_ParkEvent->park(1);
            } else {
-              os::NakedYield() ;
+              os::NakedYield();
            }
          }
-         Thread::muxRelease (InflationLocks + ix ) ;
-         TEVENT (Inflate: INFLATING - yield/park) ;
+         Thread::muxRelease(InflationLocks + ix);
+         TEVENT(Inflate: INFLATING - yield/park);
        }
     } else {
-       SpinPause() ;       // SMP-polite spinning
+       SpinPause();       // SMP-polite spinning
     }
   }
 }
@@ -529,48 +529,48 @@
 //
 
 static inline intptr_t get_next_hash(Thread * Self, oop obj) {
-  intptr_t value = 0 ;
+  intptr_t value = 0;
   if (hashCode == 0) {
      // This form uses an unguarded global Park-Miller RNG,
      // so it's possible for two threads to race and generate the same RNG.
      // On MP system we'll have lots of RW access to a global, so the
      // mechanism induces lots of coherency traffic.
-     value = os::random() ;
+     value = os::random();
   } else
   if (hashCode == 1) {
      // This variation has the property of being stable (idempotent)
      // between STW operations.  This can be useful in some of the 1-0
      // synchronization schemes.
-     intptr_t addrBits = cast_from_oop<intptr_t>(obj) >> 3 ;
-     value = addrBits ^ (addrBits >> 5) ^ GVars.stwRandom ;
+     intptr_t addrBits = cast_from_oop<intptr_t>(obj) >> 3;
+     value = addrBits ^ (addrBits >> 5) ^ GVars.stwRandom;
   } else
   if (hashCode == 2) {
-     value = 1 ;            // for sensitivity testing
+     value = 1;            // for sensitivity testing
   } else
   if (hashCode == 3) {
-     value = ++GVars.hcSequence ;
+     value = ++GVars.hcSequence;
   } else
   if (hashCode == 4) {
-     value = cast_from_oop<intptr_t>(obj) ;
+     value = cast_from_oop<intptr_t>(obj);
   } else {
      // Marsaglia's xor-shift scheme with thread-specific state
      // This is probably the best overall implementation -- we'll
      // likely make this the default in future releases.
-     unsigned t = Self->_hashStateX ;
-     t ^= (t << 11) ;
-     Self->_hashStateX = Self->_hashStateY ;
-     Self->_hashStateY = Self->_hashStateZ ;
-     Self->_hashStateZ = Self->_hashStateW ;
-     unsigned v = Self->_hashStateW ;
-     v = (v ^ (v >> 19)) ^ (t ^ (t >> 8)) ;
-     Self->_hashStateW = v ;
-     value = v ;
+     unsigned t = Self->_hashStateX;
+     t ^= (t << 11);
+     Self->_hashStateX = Self->_hashStateY;
+     Self->_hashStateY = Self->_hashStateZ;
+     Self->_hashStateZ = Self->_hashStateW;
+     unsigned v = Self->_hashStateW;
+     v = (v ^ (v >> 19)) ^ (t ^ (t >> 8));
+     Self->_hashStateW = v;
+     value = v;
   }
 
   value &= markOopDesc::hash_mask;
-  if (value == 0) value = 0xBAD ;
-  assert (value != markOopDesc::no_hash, "invariant") ;
-  TEVENT (hashCode: GENERATE) ;
+  if (value == 0) value = 0xBAD;
+  assert(value != markOopDesc::no_hash, "invariant");
+  TEVENT(hashCode: GENERATE);
   return value;
 }
 //
@@ -585,25 +585,25 @@
     // thread-local storage.
     if (obj->mark()->has_bias_pattern()) {
       // Box and unbox the raw reference just in case we cause a STW safepoint.
-      Handle hobj (Self, obj) ;
+      Handle hobj(Self, obj);
       // Relaxing assertion for bug 6320749.
-      assert (Universe::verify_in_progress() ||
+      assert(Universe::verify_in_progress() ||
               !SafepointSynchronize::is_at_safepoint(),
              "biases should not be seen by VM thread here");
       BiasedLocking::revoke_and_rebias(hobj, false, JavaThread::current());
-      obj = hobj() ;
+      obj = hobj();
       assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
     }
   }
 
   // hashCode() is a heap mutator ...
   // Relaxing assertion for bug 6320749.
-  assert (Universe::verify_in_progress() ||
-          !SafepointSynchronize::is_at_safepoint(), "invariant") ;
-  assert (Universe::verify_in_progress() ||
-          Self->is_Java_thread() , "invariant") ;
-  assert (Universe::verify_in_progress() ||
-         ((JavaThread *)Self)->thread_state() != _thread_blocked, "invariant") ;
+  assert(Universe::verify_in_progress() ||
+          !SafepointSynchronize::is_at_safepoint(), "invariant");
+  assert(Universe::verify_in_progress() ||
+          Self->is_Java_thread() , "invariant");
+  assert(Universe::verify_in_progress() ||
+         ((JavaThread *)Self)->thread_state() != _thread_blocked, "invariant");
 
   ObjectMonitor* monitor = NULL;
   markOop temp, test;
@@ -611,7 +611,7 @@
   markOop mark = ReadStableMark (obj);
 
   // object should remain ineligible for biased locking
-  assert (!mark->has_bias_pattern(), "invariant") ;
+  assert(!mark->has_bias_pattern(), "invariant");
 
   if (mark->is_neutral()) {
     hash = mark->hash();              // this is a normal header
@@ -631,7 +631,7 @@
   } else if (mark->has_monitor()) {
     monitor = mark->monitor();
     temp = monitor->header();
-    assert (temp->is_neutral(), "invariant") ;
+    assert(temp->is_neutral(), "invariant");
     hash = temp->hash();
     if (hash) {
       return hash;
@@ -639,7 +639,7 @@
     // Skip to the following code to reduce code size
   } else if (Self->is_lock_owned((address)mark->locker())) {
     temp = mark->displaced_mark_helper(); // this is a lightweight monitor owned
-    assert (temp->is_neutral(), "invariant") ;
+    assert(temp->is_neutral(), "invariant");
     hash = temp->hash();              // by current thread, check if the displaced
     if (hash) {                       // header contains hash code
       return hash;
@@ -659,20 +659,20 @@
   monitor = ObjectSynchronizer::inflate(Self, obj);
   // Load displaced header and check it has hash code
   mark = monitor->header();
-  assert (mark->is_neutral(), "invariant") ;
+  assert(mark->is_neutral(), "invariant");
   hash = mark->hash();
   if (hash == 0) {
     hash = get_next_hash(Self, obj);
     temp = mark->copy_set_hash(hash); // merge hash code into header
-    assert (temp->is_neutral(), "invariant") ;
+    assert(temp->is_neutral(), "invariant");
     test = (markOop) Atomic::cmpxchg_ptr(temp, monitor, mark);
     if (test != mark) {
       // The only update to the header in the monitor (outside GC)
       // is install the hash code. If someone add new usage of
       // displaced header, please update this code
       hash = test->hash();
-      assert (test->is_neutral(), "invariant") ;
-      assert (hash != 0, "Trivial unexpected object/monitor header usage.");
+      assert(test->is_neutral(), "invariant");
+      assert(hash != 0, "Trivial unexpected object/monitor header usage.");
     }
   }
   // We finally get the hash
@@ -682,7 +682,7 @@
 // Deprecated -- use FastHashCode() instead.
 
 intptr_t ObjectSynchronizer::identity_hash_value_for(Handle obj) {
-  return FastHashCode (Thread::current(), obj()) ;
+  return FastHashCode(Thread::current(), obj());
 }
 
 
@@ -696,7 +696,7 @@
   assert(thread == JavaThread::current(), "Can only be called on current thread");
   oop obj = h_obj();
 
-  markOop mark = ReadStableMark (obj) ;
+  markOop mark = ReadStableMark(obj);
 
   // Uncontended case, header points to stack
   if (mark->has_locker()) {
@@ -705,7 +705,7 @@
   // Contended case, header points to ObjectMonitor (tagged pointer)
   if (mark->has_monitor()) {
     ObjectMonitor* monitor = mark->monitor();
-    return monitor->is_entered(thread) != 0 ;
+    return monitor->is_entered(thread) != 0;
   }
   // Unlocked case, header in place
   assert(mark->is_neutral(), "sanity check");
@@ -721,8 +721,8 @@
 (JavaThread *self, Handle h_obj) {
   // The caller must beware this method can revoke bias, and
   // revocation can result in a safepoint.
-  assert (!SafepointSynchronize::is_at_safepoint(), "invariant") ;
-  assert (self->thread_state() != _thread_blocked , "invariant") ;
+  assert(!SafepointSynchronize::is_at_safepoint(), "invariant");
+  assert(self->thread_state() != _thread_blocked , "invariant");
 
   // Possible mark states: neutral, biased, stack-locked, inflated
 
@@ -735,7 +735,7 @@
 
   assert(self == JavaThread::current(), "Can only be called on current thread");
   oop obj = h_obj();
-  markOop mark = ReadStableMark (obj) ;
+  markOop mark = ReadStableMark(obj);
 
   // CASE: stack-locked.  Mark points to a BasicLock on the owner's stack.
   if (mark->has_locker()) {
@@ -747,15 +747,15 @@
   // The Object:ObjectMonitor relationship is stable as long as we're
   // not at a safepoint.
   if (mark->has_monitor()) {
-    void * owner = mark->monitor()->_owner ;
-    if (owner == NULL) return owner_none ;
+    void * owner = mark->monitor()->_owner;
+    if (owner == NULL) return owner_none;
     return (owner == self ||
             self->is_lock_owned((address)owner)) ? owner_self : owner_other;
   }
 
   // CASE: neutral
   assert(mark->is_neutral(), "sanity check");
-  return owner_none ;           // it's unlocked
+  return owner_none;           // it's unlocked
 }
 
 // FIXME: jvmti should call this
@@ -772,7 +772,7 @@
   oop obj = h_obj();
   address owner = NULL;
 
-  markOop mark = ReadStableMark (obj) ;
+  markOop mark = ReadStableMark(obj);
 
   // Uncontended case, header points to stack
   if (mark->has_locker()) {
@@ -819,7 +819,7 @@
 // Get the next block in the block list.
 static inline ObjectMonitor* next(ObjectMonitor* block) {
   assert(block->object() == CHAINMARKER, "must be a block header");
-  block = block->FreeNext ;
+  block = block->FreeNext;
   assert(block == NULL || block->object() == CHAINMARKER, "must be a block header");
   return block;
 }
@@ -887,17 +887,17 @@
   if (ForceMonitorScavenge == 0 && Atomic::xchg (1, &ForceMonitorScavenge) == 0) {
     if (ObjectMonitor::Knob_Verbose) {
       ::printf ("Monitor scavenge - Induced STW @%s (%d)\n", Whence, ForceMonitorScavenge) ;
-      ::fflush(stdout) ;
+      ::fflush(stdout);
     }
     // Induce a 'null' safepoint to scavenge monitors
     // Must VM_Operation instance be heap allocated as the op will be enqueue and posted
     // to the VMthread and have a lifespan longer than that of this activation record.
     // The VMThread will delete the op when completed.
-    VMThread::execute (new VM_ForceAsyncSafepoint()) ;
+    VMThread::execute(new VM_ForceAsyncSafepoint());
 
     if (ObjectMonitor::Knob_Verbose) {
       ::printf ("Monitor scavenge - STW posted @%s (%d)\n", Whence, ForceMonitorScavenge) ;
-      ::fflush(stdout) ;
+      ::fflush(stdout);
     }
   }
 }
@@ -923,9 +923,9 @@
     // number of objectMonitors in circulation as well as the STW
     // scavenge costs.  As usual, we lean toward time in space-time
     // tradeoffs.
-    const int MAXPRIVATE = 1024 ;
+    const int MAXPRIVATE = 1024;
     for (;;) {
-        ObjectMonitor * m ;
+        ObjectMonitor * m;
 
         // 1: try to allocate from the thread's local omFreeList.
         // Threads will attempt to allocate first from their local list, then
@@ -933,21 +933,21 @@
         // attempt to instantiate new monitors.   Thread-local free lists take
         // heat off the ListLock and improve allocation latency, as well as reducing
         // coherency traffic on the shared global list.
-        m = Self->omFreeList ;
+        m = Self->omFreeList;
         if (m != NULL) {
-           Self->omFreeList = m->FreeNext ;
-           Self->omFreeCount -- ;
+           Self->omFreeList = m->FreeNext;
+           Self->omFreeCount--;
            // CONSIDER: set m->FreeNext = BAD -- diagnostic hygiene
-           guarantee (m->object() == NULL, "invariant") ;
+           guarantee(m->object() == NULL, "invariant");
            if (MonitorInUseLists) {
              m->FreeNext = Self->omInUseList;
              Self->omInUseList = m;
-             Self->omInUseCount ++;
+             Self->omInUseCount++;
              // verifyInUse(Self);
            } else {
              m->FreeNext = NULL;
            }
-           return m ;
+           return m;
         }
 
         // 2: try to allocate from the global gFreeList
@@ -959,27 +959,27 @@
             // Reprovision the thread's omFreeList.
             // Use bulk transfers to reduce the allocation rate and heat
             // on various locks.
-            Thread::muxAcquire (&ListLock, "omAlloc") ;
-            for (int i = Self->omFreeProvision; --i >= 0 && gFreeList != NULL; ) {
-                MonitorFreeCount --;
-                ObjectMonitor * take = gFreeList ;
-                gFreeList = take->FreeNext ;
-                guarantee (take->object() == NULL, "invariant") ;
-                guarantee (!take->is_busy(), "invariant") ;
-                take->Recycle() ;
-                omRelease (Self, take, false) ;
+            Thread::muxAcquire(&ListLock, "omAlloc");
+            for (int i = Self->omFreeProvision; --i >= 0 && gFreeList != NULL;) {
+                MonitorFreeCount--;
+                ObjectMonitor * take = gFreeList;
+                gFreeList = take->FreeNext;
+                guarantee(take->object() == NULL, "invariant");
+                guarantee(!take->is_busy(), "invariant");
+                take->Recycle();
+                omRelease(Self, take, false);
             }
-            Thread::muxRelease (&ListLock) ;
-            Self->omFreeProvision += 1 + (Self->omFreeProvision/2) ;
-            if (Self->omFreeProvision > MAXPRIVATE ) Self->omFreeProvision = MAXPRIVATE ;
-            TEVENT (omFirst - reprovision) ;
+            Thread::muxRelease(&ListLock);
+            Self->omFreeProvision += 1 + (Self->omFreeProvision/2);
+            if (Self->omFreeProvision > MAXPRIVATE) Self->omFreeProvision = MAXPRIVATE;
+            TEVENT(omFirst - reprovision);
 
-            const int mx = MonitorBound ;
+            const int mx = MonitorBound;
             if (mx > 0 && (MonitorPopulation-MonitorFreeCount) > mx) {
               // We can't safely induce a STW safepoint from omAlloc() as our thread
               // state may not be appropriate for such activities and callers may hold
               // naked oops, so instead we defer the action.
-              InduceScavenge (Self, "omAlloc") ;
+              InduceScavenge(Self, "omAlloc");
             }
             continue;
         }
@@ -987,14 +987,14 @@
         // 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.
-        assert (_BLOCKSIZE > 1, "invariant") ;
+        assert(_BLOCKSIZE > 1, "invariant");
         ObjectMonitor * temp = new ObjectMonitor[_BLOCKSIZE];
 
         // 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(sizeof (ObjectMonitor[_BLOCKSIZE]), OOM_MALLOC_ERROR,
                                    "Allocate ObjectMonitors");
         }
 
@@ -1006,12 +1006,12 @@
         // linkage should be reconsidered.  A better implementation would
         // look like: class Block { Block * next; int N; ObjectMonitor Body [N] ; }
 
-        for (int i = 1; i < _BLOCKSIZE ; i++) {
+        for (int i = 1; i < _BLOCKSIZE; i++) {
            temp[i].FreeNext = &temp[i+1];
         }
 
         // terminate the last monitor as the end of list
-        temp[_BLOCKSIZE - 1].FreeNext = NULL ;
+        temp[_BLOCKSIZE - 1].FreeNext = NULL;
 
         // Element [0] is reserved for global list linkage
         temp[0].set_object(CHAINMARKER);
@@ -1022,7 +1022,7 @@
 
         // Acquire the ListLock to manipulate BlockList and FreeList.
         // An Oyama-Taura-Yonezawa scheme might be more efficient.
-        Thread::muxAcquire (&ListLock, "omAlloc [2]") ;
+        Thread::muxAcquire(&ListLock, "omAlloc [2]");
         MonitorPopulation += _BLOCKSIZE-1;
         MonitorFreeCount += _BLOCKSIZE-1;
 
@@ -1033,10 +1033,10 @@
         gBlockList = temp;
 
         // Add the new string of objectMonitors to the global free list
-        temp[_BLOCKSIZE - 1].FreeNext = gFreeList ;
+        temp[_BLOCKSIZE - 1].FreeNext = gFreeList;
         gFreeList = temp + 1;
-        Thread::muxRelease (&ListLock) ;
-        TEVENT (Allocate block of monitors) ;
+        Thread::muxRelease(&ListLock);
+        TEVENT(Allocate block of monitors);
     }
 }
 
@@ -1049,12 +1049,12 @@
 //
 
 void ObjectSynchronizer::omRelease (Thread * Self, ObjectMonitor * m, bool fromPerThreadAlloc) {
-    guarantee (m->object() == NULL, "invariant") ;
+    guarantee(m->object() == NULL, "invariant");
 
     // Remove from omInUseList
     if (MonitorInUseLists && fromPerThreadAlloc) {
       ObjectMonitor* curmidinuse = NULL;
-      for (ObjectMonitor* mid = Self->omInUseList; mid != NULL; ) {
+      for (ObjectMonitor* mid = Self->omInUseList; mid != NULL;) {
        if (m == mid) {
          // extract from per-thread in-use-list
          if (mid == Self->omInUseList) {
@@ -1062,7 +1062,7 @@
          } else if (curmidinuse != NULL) {
            curmidinuse->FreeNext = mid->FreeNext; // maintain the current thread inuselist
          }
-         Self->omInUseCount --;
+         Self->omInUseCount--;
          // verifyInUse(Self);
          break;
        } else {
@@ -1073,9 +1073,9 @@
   }
 
   // FreeNext is used for both onInUseList and omFreeList, so clear old before setting new
-  m->FreeNext = Self->omFreeList ;
-  Self->omFreeList = m ;
-  Self->omFreeCount ++ ;
+  m->FreeNext = Self->omFreeList;
+  Self->omFreeList = m;
+  Self->omFreeCount++;
 }
 
 // Return the monitors of a moribund thread's local free list to
@@ -1099,25 +1099,25 @@
 // operator.
 
 void ObjectSynchronizer::omFlush (Thread * Self) {
-    ObjectMonitor * List = Self->omFreeList ;  // Null-terminated SLL
-    Self->omFreeList = NULL ;
-    ObjectMonitor * Tail = NULL ;
+    ObjectMonitor * List = Self->omFreeList;  // Null-terminated SLL
+    Self->omFreeList = NULL;
+    ObjectMonitor * Tail = NULL;
     int Tally = 0;
     if (List != NULL) {
-      ObjectMonitor * s ;
-      for (s = List ; s != NULL ; s = s->FreeNext) {
-          Tally ++ ;
-          Tail = s ;
-          guarantee (s->object() == NULL, "invariant") ;
-          guarantee (!s->is_busy(), "invariant") ;
-          s->set_owner (NULL) ;   // redundant but good hygiene
-          TEVENT (omFlush - Move one) ;
+      ObjectMonitor * s;
+      for (s = List; s != NULL; s = s->FreeNext) {
+          Tally++;
+          Tail = s;
+          guarantee(s->object() == NULL, "invariant");
+          guarantee(!s->is_busy(), "invariant");
+          s->set_owner(NULL);   // redundant but good hygiene
+          TEVENT(omFlush - Move one);
       }
-      guarantee (Tail != NULL && List != NULL, "invariant") ;
+      guarantee(Tail != NULL && List != NULL, "invariant");
     }
 
     ObjectMonitor * InUseList = Self->omInUseList;
-    ObjectMonitor * InUseTail = NULL ;
+    ObjectMonitor * InUseTail = NULL;
     int InUseTally = 0;
     if (InUseList != NULL) {
       Self->omInUseList = NULL;
@@ -1129,13 +1129,13 @@
 // TODO debug
       assert(Self->omInUseCount == InUseTally, "inuse count off");
       Self->omInUseCount = 0;
-      guarantee (InUseTail != NULL && InUseList != NULL, "invariant");
+      guarantee(InUseTail != NULL && InUseList != NULL, "invariant");
     }
 
-    Thread::muxAcquire (&ListLock, "omFlush") ;
+    Thread::muxAcquire(&ListLock, "omFlush");
     if (Tail != NULL) {
-      Tail->FreeNext = gFreeList ;
-      gFreeList = List ;
+      Tail->FreeNext = gFreeList;
+      gFreeList = List;
       MonitorFreeCount += Tally;
     }
 
@@ -1145,8 +1145,8 @@
       gOmInUseCount += InUseTally;
     }
 
-    Thread::muxRelease (&ListLock) ;
-    TEVENT (omFlush) ;
+    Thread::muxRelease(&ListLock);
+    TEVENT(omFlush);
 }
 
 // Fast path code shared by multiple functions
@@ -1168,12 +1168,12 @@
 ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
   // Inflate mutates the heap ...
   // Relaxing assertion for bug 6320749.
-  assert (Universe::verify_in_progress() ||
-          !SafepointSynchronize::is_at_safepoint(), "invariant") ;
+  assert(Universe::verify_in_progress() ||
+          !SafepointSynchronize::is_at_safepoint(), "invariant");
 
   for (;;) {
-      const markOop mark = object->mark() ;
-      assert (!mark->has_bias_pattern(), "invariant") ;
+      const markOop mark = object->mark();
+      assert(!mark->has_bias_pattern(), "invariant");
 
       // The mark can be in one of the following states:
       // *  Inflated     - just return
@@ -1184,11 +1184,11 @@
 
       // CASE: inflated
       if (mark->has_monitor()) {
-          ObjectMonitor * inf = mark->monitor() ;
-          assert (inf->header()->is_neutral(), "invariant");
-          assert (inf->object() == object, "invariant") ;
-          assert (ObjectSynchronizer::verify_objmon_isinpool(inf), "monitor is invalid");
-          return inf ;
+          ObjectMonitor * inf = mark->monitor();
+          assert(inf->header()->is_neutral(), "invariant");
+          assert(inf->object() == object, "invariant");
+          assert(ObjectSynchronizer::verify_objmon_isinpool(inf), "monitor is invalid");
+          return inf;
       }
 
       // CASE: inflation in progress - inflating over a stack-lock.
@@ -1198,9 +1198,9 @@
       // Currently, we spin/yield/park and poll the markword, waiting for inflation to finish.
       // We could always eliminate polling by parking the thread on some auxiliary list.
       if (mark == markOopDesc::INFLATING()) {
-         TEVENT (Inflate: spin while INFLATING) ;
-         ReadStableMark(object) ;
-         continue ;
+         TEVENT(Inflate: spin while INFLATING);
+         ReadStableMark(object);
+         continue;
       }
 
       // CASE: stack-locked
@@ -1223,20 +1223,20 @@
       // See the comments in omAlloc().
 
       if (mark->has_locker()) {
-          ObjectMonitor * m = omAlloc (Self) ;
+          ObjectMonitor * m = omAlloc(Self);
           // Optimistically prepare the objectmonitor - anticipate successful CAS
           // We do this before the CAS in order to minimize the length of time
           // 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
+          m->_Responsible  = NULL;
+          m->OwnerIsThread = 0;
+          m->_recursions   = 0;
+          m->_SpinDuration = ObjectMonitor::Knob_SpinLimit;   // Consider: maintain by type/class
 
-          markOop cmp = (markOop) Atomic::cmpxchg_ptr (markOopDesc::INFLATING(), object->mark_addr(), mark) ;
+          markOop cmp = (markOop) Atomic::cmpxchg_ptr(markOopDesc::INFLATING(), object->mark_addr(), mark);
           if (cmp != mark) {
-             omRelease (Self, m, true) ;
-             continue ;       // Interference -- just retry
+             omRelease(Self, m, true);
+             continue;       // Interference -- just retry
           }
 
           // We've successfully installed INFLATING (0) into the mark-word.
@@ -1269,11 +1269,11 @@
           // The owner can't die or unwind past the lock while our INFLATING
           // object is in the mark.  Furthermore the owner can't complete
           // an unlock on the object, either.
-          markOop dmw = mark->displaced_mark_helper() ;
-          assert (dmw->is_neutral(), "invariant") ;
+          markOop dmw = mark->displaced_mark_helper();
+          assert(dmw->is_neutral(), "invariant");
 
           // Setup monitor fields to proper values -- prepare the monitor
-          m->set_header(dmw) ;
+          m->set_header(dmw);
 
           // Optimization: if the mark->locker stack address is associated
           // with this thread we could simply set m->_owner = Self and
@@ -1286,13 +1286,13 @@
 
           // Must preserve store ordering. The monitor state must
           // be stable at the time of publishing the monitor address.
-          guarantee (object->mark() == markOopDesc::INFLATING(), "invariant") ;
+          guarantee(object->mark() == markOopDesc::INFLATING(), "invariant");
           object->release_set_mark(markOopDesc::encode(m));
 
           // Hopefully the performance counters are allocated on distinct cache lines
           // to avoid false sharing on MP systems ...
-          if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc() ;
-          TEVENT(Inflate: overwrite stacklock) ;
+          if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc();
+          TEVENT(Inflate: overwrite stacklock);
           if (TraceMonitorInflation) {
             if (object->is_instance()) {
               ResourceMark rm;
@@ -1301,7 +1301,7 @@
                 object->klass()->external_name());
             }
           }
-          return m ;
+          return m;
       }
 
       // CASE: neutral
@@ -1314,26 +1314,26 @@
       // An inflateTry() method that we could call from fast_enter() and slow_enter()
       // would be useful.
 
-      assert (mark->is_neutral(), "invariant");
-      ObjectMonitor * m = omAlloc (Self) ;
+      assert(mark->is_neutral(), "invariant");
+      ObjectMonitor * m = omAlloc(Self);
       // prepare m for installation - set monitor to initial state
       m->Recycle();
       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
+      m->OwnerIsThread = 1;
+      m->_recursions   = 0;
+      m->_Responsible  = NULL;
+      m->_SpinDuration = ObjectMonitor::Knob_SpinLimit;       // consider: keep metastats by type/class
 
       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 ;
-          continue ;
+          m->set_object(NULL);
+          m->set_owner(NULL);
+          m->OwnerIsThread = 0;
+          m->Recycle();
+          omRelease(Self, m, true);
+          m = NULL;
+          continue;
           // interference - the markword changed - just retry.
           // The state-transitions are one-way, so there's no chance of
           // live-lock -- "Inflated" is an absorbing state.
@@ -1341,8 +1341,8 @@
 
       // Hopefully the performance counters are allocated on distinct
       // cache lines to avoid false sharing on MP systems ...
-      if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc() ;
-      TEVENT(Inflate: overwrite neutral) ;
+      if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc();
+      TEVENT(Inflate: overwrite neutral);
       if (TraceMonitorInflation) {
         if (object->is_instance()) {
           ResourceMark rm;
@@ -1351,7 +1351,7 @@
             object->klass()->external_name());
         }
       }
-      return m ;
+      return m;
   }
 }
 
@@ -1391,7 +1391,7 @@
 enum ManifestConstants {
     ClearResponsibleAtSTW   = 0,
     MaximumRecheckInterval  = 1000
-} ;
+};
 
 // Deflate a single monitor if not in use
 // Return true if deflated, false if in use
@@ -1399,18 +1399,18 @@
                                          ObjectMonitor** FreeHeadp, ObjectMonitor** FreeTailp) {
   bool deflated;
   // Normal case ... The monitor is associated with obj.
-  guarantee (obj->mark() == markOopDesc::encode(mid), "invariant") ;
-  guarantee (mid == obj->mark()->monitor(), "invariant");
-  guarantee (mid->header()->is_neutral(), "invariant");
+  guarantee(obj->mark() == markOopDesc::encode(mid), "invariant");
+  guarantee(mid == obj->mark()->monitor(), "invariant");
+  guarantee(mid->header()->is_neutral(), "invariant");
 
   if (mid->is_busy()) {
-     if (ClearResponsibleAtSTW) mid->_Responsible = NULL ;
+     if (ClearResponsibleAtSTW) mid->_Responsible = NULL;
      deflated = false;
   } else {
      // Deflate the monitor if it is no longer being used
      // It's idle - scavenge and return to the global free list
      // plain old deflation ...
-     TEVENT (deflate_idle_monitors - scavenge1) ;
+     TEVENT(deflate_idle_monitors - scavenge1);
      if (TraceMonitorInflation) {
        if (obj->is_instance()) {
          ResourceMark rm;
@@ -1423,7 +1423,7 @@
      obj->release_set_mark(mid->header());
      mid->clear();
 
-     assert (mid->object() == NULL, "invariant") ;
+     assert(mid->object() == NULL, "invariant");
 
      // Move the object to the working free list defined by FreeHead,FreeTail.
      if (*FreeHeadp == NULL) *FreeHeadp = mid;
@@ -1446,7 +1446,7 @@
   ObjectMonitor* curmidinuse = NULL;
   int deflatedcount = 0;
 
-  for (mid = *listheadp; mid != NULL; ) {
+  for (mid = *listheadp; mid != NULL;) {
      oop obj = (oop) mid->object();
      bool deflated = false;
      if (obj != NULL) {
@@ -1473,19 +1473,19 @@
 
 void ObjectSynchronizer::deflate_idle_monitors() {
   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
-  int nInuse = 0 ;              // currently associated with objects
-  int nInCirculation = 0 ;      // extant
-  int nScavenged = 0 ;          // reclaimed
+  int nInuse = 0;              // currently associated with objects
+  int nInCirculation = 0;      // extant
+  int nScavenged = 0;          // reclaimed
   bool deflated = false;
 
-  ObjectMonitor * FreeHead = NULL ;  // Local SLL of scavenged monitors
-  ObjectMonitor * FreeTail = NULL ;
+  ObjectMonitor * FreeHead = NULL;  // Local SLL of scavenged monitors
+  ObjectMonitor * FreeTail = NULL;
 
-  TEVENT (deflate_idle_monitors) ;
+  TEVENT(deflate_idle_monitors);
   // Prevent omFlush from changing mids in Thread dtor's during deflation
   // And in case the vm thread is acquiring a lock during a safepoint
   // See e.g. 6320749
-  Thread::muxAcquire (&ListLock, "scavenge - return") ;
+  Thread::muxAcquire(&ListLock, "scavenge - return");
 
   if (MonitorInUseLists) {
     int inUse = 0;
@@ -1510,8 +1510,8 @@
   } else for (ObjectMonitor* block = gBlockList; block != NULL; block = 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++) {
+    nInCirculation += _BLOCKSIZE;
+    for (int i = 1; i < _BLOCKSIZE; i++) {
       ObjectMonitor* mid = &block[i];
       oop obj = (oop) mid->object();
 
@@ -1520,16 +1520,16 @@
         // The monitor should either be a thread-specific private
         // free list or the global free list.
         // obj == NULL IMPLIES mid->is_busy() == 0
-        guarantee (!mid->is_busy(), "invariant") ;
-        continue ;
+        guarantee(!mid->is_busy(), "invariant");
+        continue;
       }
       deflated = deflate_monitor(mid, obj, &FreeHead, &FreeTail);
 
       if (deflated) {
-        mid->FreeNext = NULL ;
-        nScavenged ++ ;
+        mid->FreeNext = NULL;
+        nScavenged++;
       } else {
-        nInuse ++;
+        nInuse++;
       }
     }
   }
@@ -1539,31 +1539,31 @@
   // Consider: audit gFreeList to ensure that MonitorFreeCount and list agree.
 
   if (ObjectMonitor::Knob_Verbose) {
-    ::printf ("Deflate: InCirc=%d InUse=%d Scavenged=%d ForceMonitorScavenge=%d : pop=%d free=%d\n",
+    ::printf("Deflate: InCirc=%d InUse=%d Scavenged=%d ForceMonitorScavenge=%d : pop=%d free=%d\n",
         nInCirculation, nInuse, nScavenged, ForceMonitorScavenge,
-        MonitorPopulation, MonitorFreeCount) ;
-    ::fflush(stdout) ;
+        MonitorPopulation, MonitorFreeCount);
+    ::fflush(stdout);
   }
 
   ForceMonitorScavenge = 0;    // Reset
 
   // Move the scavenged monitors back to the global free list.
   if (FreeHead != NULL) {
-     guarantee (FreeTail != NULL && nScavenged > 0, "invariant") ;
-     assert (FreeTail->FreeNext == NULL, "invariant") ;
+     guarantee(FreeTail != NULL && nScavenged > 0, "invariant");
+     assert(FreeTail->FreeNext == NULL, "invariant");
      // constant-time list splice - prepend scavenged segment to gFreeList
-     FreeTail->FreeNext = gFreeList ;
-     gFreeList = FreeHead ;
+     FreeTail->FreeNext = gFreeList;
+     gFreeList = FreeHead;
   }
-  Thread::muxRelease (&ListLock) ;
+  Thread::muxRelease(&ListLock);
 
-  if (ObjectMonitor::_sync_Deflations != NULL) ObjectMonitor::_sync_Deflations->inc(nScavenged) ;
+  if (ObjectMonitor::_sync_Deflations != NULL) ObjectMonitor::_sync_Deflations->inc(nScavenged);
   if (ObjectMonitor::_sync_MonExtant  != NULL) ObjectMonitor::_sync_MonExtant ->set_value(nInCirculation);
 
   // TODO: Add objectMonitor leak detection.
   // Audit/inventory the objectMonitors -- make sure they're all accounted for.
-  GVars.stwRandom = os::random() ;
-  GVars.stwCycle ++ ;
+  GVars.stwRandom = os::random();
+  GVars.stwCycle++;
 }
 
 // Monitor cleanup on JavaThread::exit
@@ -1601,7 +1601,7 @@
 
 void ObjectSynchronizer::release_monitors_owned_by_thread(TRAPS) {
   assert(THREAD == JavaThread::current(), "must be current Java thread");
-  No_Safepoint_Verifier nsv ;
+  No_Safepoint_Verifier nsv;
   ReleaseJavaMonitorsClosure rjmc(THREAD);
   Thread::muxAcquire(&ListLock, "release_monitors_owned_by_thread");
   ObjectSynchronizer::monitors_iterate(&rjmc);
--- a/hotspot/src/share/vm/runtime/synchronizer.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/synchronizer.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -75,7 +75,7 @@
   // Special internal-use-only method for use by JVM infrastructure
   // that needs to wait() on a java-level object but that can't risk
   // throwing unexpected InterruptedExecutionExceptions.
-  static void waitUninterruptibly (Handle obj, jlong Millis, Thread * THREAD) ;
+  static void waitUninterruptibly(Handle obj, jlong Millis, Thread * THREAD);
 
   // used by classloading to free classloader object lock,
   // wait on an internal lock, and reclaim original lock
@@ -85,9 +85,9 @@
 
   // thread-specific and global objectMonitor free list accessors
 //  static void verifyInUse (Thread * Self) ; too slow for general assert/debug
-  static ObjectMonitor * omAlloc (Thread * Self) ;
-  static void omRelease (Thread * Self, ObjectMonitor * m, bool FromPerThreadAlloc) ;
-  static void omFlush   (Thread * Self) ;
+  static ObjectMonitor * omAlloc(Thread * Self);
+  static void omRelease(Thread * Self, ObjectMonitor * m, bool FromPerThreadAlloc);
+  static void omFlush(Thread * Self);
 
   // Inflate light weight monitor to heavy weight monitor
   static ObjectMonitor* inflate(Thread * Self, oop obj);
@@ -97,7 +97,7 @@
   // Returns the identity hash value for an oop
   // NOTE: It may cause monitor inflation
   static intptr_t identity_hash_value_for(Handle obj);
-  static intptr_t FastHashCode (Thread * Self, oop obj) ;
+  static intptr_t FastHashCode(Thread * Self, oop obj);
 
   // java.lang.Thread support
   static bool current_thread_holds_lock(JavaThread* thread, Handle h_obj);
@@ -124,7 +124,7 @@
   static void verify() PRODUCT_RETURN;
   static int  verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0;
 
-  static void RegisterSpinCallback (int (*)(intptr_t, int), intptr_t) ;
+  static void RegisterSpinCallback(int(*)(intptr_t, int), intptr_t);
 
  private:
   enum { _BLOCKSIZE = 128 };
@@ -155,7 +155,7 @@
   // Monitor behavior
   void wait      (TRAPS)      { ObjectSynchronizer::wait     (_obj, 0, CHECK); } // wait forever
   void notify_all(TRAPS)      { ObjectSynchronizer::notifyall(_obj,    CHECK); }
-  void waitUninterruptibly (TRAPS) { ObjectSynchronizer::waitUninterruptibly (_obj, 0, CHECK);}
+  void waitUninterruptibly (TRAPS) { ObjectSynchronizer::waitUninterruptibly (_obj, 0, CHECK); }
   // complete_exit gives up lock completely, returning recursion count
   // reenter reclaims lock with original recursion count
   intptr_t complete_exit(TRAPS) { return  ObjectSynchronizer::complete_exit(_obj, CHECK_0); }
--- a/hotspot/src/share/vm/runtime/thread.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -225,11 +225,11 @@
   _current_pending_monitor_is_from_java = true;
   _current_waiting_monitor = NULL;
   _num_nested_signal = 0;
-  omFreeList = NULL ;
-  omFreeCount = 0 ;
-  omFreeProvision = 32 ;
-  omInUseList = NULL ;
-  omInUseCount = 0 ;
+  omFreeList = NULL;
+  omFreeCount = 0;
+  omFreeProvision = 32;
+  omInUseList = NULL;
+  omInUseCount = 0;
 
 #ifdef ASSERT
   _visited_for_critical_count = false;
@@ -239,15 +239,15 @@
   _suspend_flags = 0;
 
   // thread-specific hashCode stream generator state - Marsaglia shift-xor form
-  _hashStateX = os::random() ;
-  _hashStateY = 842502087 ;
-  _hashStateZ = 0x8767 ;    // (int)(3579807591LL & 0xffff) ;
-  _hashStateW = 273326509 ;
-
-  _OnTrap   = 0 ;
-  _schedctl = NULL ;
-  _Stalled  = 0 ;
-  _TypeTag  = 0x2BAD ;
+  _hashStateX = os::random();
+  _hashStateY = 842502087;
+  _hashStateZ = 0x8767;    // (int)(3579807591LL & 0xffff) ;
+  _hashStateW = 273326509;
+
+  _OnTrap   = 0;
+  _schedctl = NULL;
+  _Stalled  = 0;
+  _TypeTag  = 0x2BAD;
 
   // Many of the following fields are effectively final - immutable
   // Note that nascent threads can't use the Native Monitor-Mutex
@@ -256,10 +256,10 @@
   // we might instead use a stack of ParkEvents that we could provision on-demand.
   // The stack would act as a cache to avoid calls to ParkEvent::Allocate()
   // and ::Release()
-  _ParkEvent   = ParkEvent::Allocate (this) ;
-  _SleepEvent  = ParkEvent::Allocate (this) ;
-  _MutexEvent  = ParkEvent::Allocate (this) ;
-  _MuxEvent    = ParkEvent::Allocate (this) ;
+  _ParkEvent   = ParkEvent::Allocate(this);
+  _SleepEvent  = ParkEvent::Allocate(this);
+  _MutexEvent  = ParkEvent::Allocate(this);
+  _MuxEvent    = ParkEvent::Allocate(this);
 
 #ifdef CHECK_UNHANDLED_OOPS
   if (CheckUnhandledOops) {
@@ -314,7 +314,7 @@
 
 Thread::~Thread() {
   // Reclaim the objectmonitors from the omFreeList of the moribund thread.
-  ObjectSynchronizer::omFlush (this) ;
+  ObjectSynchronizer::omFlush(this);
 
   EVENT_THREAD_DESTRUCT(this);
 
@@ -342,10 +342,10 @@
 
   // It's possible we can encounter a null _ParkEvent, etc., in stillborn threads.
   // We NULL out the fields for good hygiene.
-  ParkEvent::Release (_ParkEvent)   ; _ParkEvent   = NULL ;
-  ParkEvent::Release (_SleepEvent)  ; _SleepEvent  = NULL ;
-  ParkEvent::Release (_MutexEvent)  ; _MutexEvent  = NULL ;
-  ParkEvent::Release (_MuxEvent)    ; _MuxEvent    = NULL ;
+  ParkEvent::Release(_ParkEvent); _ParkEvent   = NULL;
+  ParkEvent::Release(_SleepEvent); _SleepEvent  = NULL;
+  ParkEvent::Release(_MutexEvent); _MutexEvent  = NULL;
+  ParkEvent::Release(_MuxEvent); _MuxEvent    = NULL;
 
   delete handle_area();
   delete metadata_handles();
@@ -844,7 +844,7 @@
 // Thread::print_on_error() is called by fatal error handler. Don't use
 // any lock or allocate memory.
 void Thread::print_on_error(outputStream* st, char* buf, int buflen) const {
-  if      (is_VM_thread())                  st->print("VMThread");
+  if (is_VM_thread())                  st->print("VMThread");
   else if (is_Compiler_thread())            st->print("CompilerThread");
   else if (is_Java_thread())                st->print("JavaThread");
   else if (is_GC_task_thread())             st->print("GCTaskThread");
@@ -867,7 +867,7 @@
     st->print(" (no locks) ");
   } else {
     st->print_cr(" Locks owned:");
-    while(cur) {
+    while (cur) {
       cur->print_on(st);
       cur = cur->next();
     }
@@ -877,7 +877,7 @@
 static int ref_use_count  = 0;
 
 bool Thread::owns_locks_but_compiled_lock() const {
-  for(Monitor *cur = _owned_locks; cur; cur = cur->next()) {
+  for (Monitor *cur = _owned_locks; cur; cur = cur->next()) {
     if (cur != Compile_lock) return true;
   }
   return false;
@@ -904,12 +904,12 @@
         && !Universe::is_bootstrapping()) {
       // Make sure we do not hold any locks that the VM thread also uses.
       // This could potentially lead to deadlocks
-      for(Monitor *cur = _owned_locks; cur; cur = cur->next()) {
+      for (Monitor *cur = _owned_locks; cur; cur = cur->next()) {
         // Threads_lock is special, since the safepoint synchronization will not start before this is
         // acquired. Hence, a JavaThread cannot be holding it at a safepoint. So is VMOperationRequest_lock,
         // since it is used to transfer control between JavaThreads and the VMThread
         // Do not *exclude* any locks unless you are absolutely sure it is correct. Ask someone else first!
-        if ( (cur->allow_vm_block() &&
+        if ((cur->allow_vm_block() &&
               cur != Threads_lock &&
               cur != Compile_lock &&               // Temporary: should not be necessary when we get separate compilation
               cur != VMOperationRequest_lock &&
@@ -1291,9 +1291,9 @@
   this->record_stack_base_and_size();
   this->initialize_thread_local_storage();
   this->set_active_handles(JNIHandleBlock::allocate_block());
-  while(!_should_terminate) {
-    assert(watcher_thread() == Thread::current(),  "thread consistency check");
-    assert(watcher_thread() == this,  "thread consistency check");
+  while (!_should_terminate) {
+    assert(watcher_thread() == Thread::current(), "thread consistency check");
+    assert(watcher_thread() == this, "thread consistency check");
 
     // Calculate how long it'll be until the next PeriodicTask work
     // should be done, and sleep that amount of time.
@@ -1370,7 +1370,7 @@
   // it is ok to take late safepoints here, if needed
   MutexLocker mu(Terminator_lock);
 
-  while(watcher_thread() != NULL) {
+  while (watcher_thread() != NULL) {
     // This wait should make safepoint checks, wait without a timeout,
     // and wait as a suspend-equivalent condition.
     //
@@ -1448,13 +1448,14 @@
   _thread_stat = new ThreadStatistics();
   _blocked_on_compilation = false;
   _jni_active_critical = 0;
+  _pending_jni_exception_check_fn = NULL;
   _do_not_unlock_if_synchronized = false;
   _cached_monitor_info = NULL;
-  _parker = Parker::Allocate(this) ;
+  _parker = Parker::Allocate(this);
 
 #ifndef PRODUCT
   _jmp_ring_index = 0;
-  for (int ji = 0 ; ji < jump_ring_buffer_size ; ji++ ) {
+  for (int ji = 0; ji < jump_ring_buffer_size; ji++) {
     record_jump(NULL, NULL, NULL, 0);
   }
 #endif /* PRODUCT */
@@ -1591,7 +1592,7 @@
 
   // JSR166 -- return the parker to the free list
   Parker::Release(_parker);
-  _parker = NULL ;
+  _parker = NULL;
 
   // Free any remaining  previous UnrollBlock
   vframeArray* old_array = vframe_array_last();
@@ -1717,7 +1718,7 @@
 // For any new cleanup additions, please check to see if they need to be applied to
 // cleanup_failed_attach_current_thread as well.
 void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
-  assert(this == JavaThread::current(),  "thread consistency check");
+  assert(this == JavaThread::current(), "thread consistency check");
 
   HandleMark hm(this);
   Handle uncaught_exception(this, this->pending_exception());
@@ -1738,55 +1739,26 @@
 
     CLEAR_PENDING_EXCEPTION;
   }
-  // FIXIT: The is_null check is only so it works better on JDK1.2 VM's. This
-  // has to be fixed by a runtime query method
-  if (!destroy_vm || JDK_Version::is_jdk12x_version()) {
-    // JSR-166: change call from from ThreadGroup.uncaughtException to
-    // java.lang.Thread.dispatchUncaughtException
+  if (!destroy_vm) {
     if (uncaught_exception.not_null()) {
-      Handle group(this, java_lang_Thread::threadGroup(threadObj()));
-      {
-        EXCEPTION_MARK;
-        // Check if the method Thread.dispatchUncaughtException() exists. If so
-        // call it.  Otherwise we have an older library without the JSR-166 changes,
-        // so call ThreadGroup.uncaughtException()
-        KlassHandle recvrKlass(THREAD, threadObj->klass());
-        CallInfo callinfo;
-        KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass());
-        LinkResolver::resolve_virtual_call(callinfo, threadObj, recvrKlass, thread_klass,
-                                           vmSymbols::dispatchUncaughtException_name(),
-                                           vmSymbols::throwable_void_signature(),
-                                           KlassHandle(), false, false, THREAD);
+      EXCEPTION_MARK;
+      // Call method Thread.dispatchUncaughtException().
+      KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass());
+      JavaValue result(T_VOID);
+      JavaCalls::call_virtual(&result,
+                              threadObj, thread_klass,
+                              vmSymbols::dispatchUncaughtException_name(),
+                              vmSymbols::throwable_void_signature(),
+                              uncaught_exception,
+                              THREAD);
+      if (HAS_PENDING_EXCEPTION) {
+        ResourceMark rm(this);
+        jio_fprintf(defaultStream::error_stream(),
+              "\nException: %s thrown from the UncaughtExceptionHandler"
+              " in thread \"%s\"\n",
+              pending_exception()->klass()->external_name(),
+              get_thread_name());
         CLEAR_PENDING_EXCEPTION;
-        methodHandle method = callinfo.selected_method();
-        if (method.not_null()) {
-          JavaValue result(T_VOID);
-          JavaCalls::call_virtual(&result,
-                                  threadObj, thread_klass,
-                                  vmSymbols::dispatchUncaughtException_name(),
-                                  vmSymbols::throwable_void_signature(),
-                                  uncaught_exception,
-                                  THREAD);
-        } else {
-          KlassHandle thread_group(THREAD, SystemDictionary::ThreadGroup_klass());
-          JavaValue result(T_VOID);
-          JavaCalls::call_virtual(&result,
-                                  group, thread_group,
-                                  vmSymbols::uncaughtException_name(),
-                                  vmSymbols::thread_throwable_void_signature(),
-                                  threadObj,           // Arg 1
-                                  uncaught_exception,  // Arg 2
-                                  THREAD);
-        }
-        if (HAS_PENDING_EXCEPTION) {
-          ResourceMark rm(this);
-          jio_fprintf(defaultStream::error_stream(),
-                "\nException: %s thrown from the UncaughtExceptionHandler"
-                " in thread \"%s\"\n",
-                pending_exception()->klass()->external_name(),
-                get_thread_name());
-          CLEAR_PENDING_EXCEPTION;
-        }
       }
     }
 
@@ -2086,7 +2058,7 @@
       if (TraceExceptions) {
         ResourceMark rm;
         tty->print("Async. exception installed at runtime exit (" INTPTR_FORMAT ")", this);
-        if (has_last_Java_frame() ) {
+        if (has_last_Java_frame()) {
           frame f = last_frame();
           tty->print(" (pc: " INTPTR_FORMAT " sp: " INTPTR_FORMAT " )", f.pc(), f.sp());
         }
@@ -2330,11 +2302,11 @@
 void JavaThread::verify_not_published() {
   if (!Threads_lock->owned_by_self()) {
    MutexLockerEx ml(Threads_lock,  Mutex::_no_safepoint_check_flag);
-   assert( !Threads::includes(this),
+   assert(!Threads::includes(this),
            "java thread shouldn't have been published yet!");
   }
   else {
-   assert( !Threads::includes(this),
+   assert(!Threads::includes(this),
            "java thread shouldn't have been published yet!");
   }
 }
@@ -2403,7 +2375,7 @@
     thread->clear_deopt_suspend();
     RegisterMap map(thread, false);
     frame f = thread->last_frame();
-    while ( f.id() != thread->must_deopt_id() && ! f.is_first_frame()) {
+    while (f.id() != thread->must_deopt_id() && ! f.is_first_frame()) {
       f = f.sender(&map);
     }
     if (f.id() == thread->must_deopt_id()) {
@@ -2527,8 +2499,8 @@
   // We need to adjust it to work correctly with guard_memory()
   address base = stack_yellow_zone_base() - stack_yellow_zone_size();
 
-  guarantee(base < stack_base(),"Error calculating stack yellow zone");
-  guarantee(base < os::current_stack_pointer(),"Error calculating stack yellow zone");
+  guarantee(base < stack_base(), "Error calculating stack yellow zone");
+  guarantee(base < os::current_stack_pointer(), "Error calculating stack yellow zone");
 
   if (os::guard_memory((char *) base, stack_yellow_zone_size())) {
     _stack_guard_state = stack_guard_enabled;
@@ -2563,10 +2535,10 @@
   assert(_stack_guard_state != stack_guard_unused, "must be using guard pages.");
   address base = stack_red_zone_base() - stack_red_zone_size();
 
-  guarantee(base < stack_base(),"Error calculating stack red zone");
-  guarantee(base < os::current_stack_pointer(),"Error calculating stack red zone");
-
-  if(!os::guard_memory((char *) base, stack_red_zone_size())) {
+  guarantee(base < stack_base(), "Error calculating stack red zone");
+  guarantee(base < os::current_stack_pointer(), "Error calculating stack red zone");
+
+  if (!os::guard_memory((char *) base, stack_red_zone_size())) {
     warning("Attempt to guard stack red zone failed.");
   }
 }
@@ -2585,7 +2557,7 @@
   // ignore is there is no stack
   if (!has_last_Java_frame()) return;
   // traverse the stack frames. Starts from top frame.
-  for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
+  for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
     frame* fr = fst.current();
     f(fr, fst.register_map());
   }
@@ -2601,8 +2573,8 @@
   bool deopt = false;           // Dump stack only if a deopt actually happens.
   bool only_at = strlen(DeoptimizeOnlyAt) > 0;
   // Iterate over all frames in the thread and deoptimize
-  for(; !fst.is_done(); fst.next()) {
-    if(fst.current()->can_be_deoptimized()) {
+  for (; !fst.is_done(); fst.next()) {
+    if (fst.current()->can_be_deoptimized()) {
 
       if (only_at) {
         // Deoptimize only at particular bcis.  DeoptimizeOnlyAt
@@ -2647,7 +2619,7 @@
 
 // Make zombies
 void JavaThread::make_zombies() {
-  for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
+  for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
     if (fst.current()->can_be_deoptimized()) {
       // it is a Java nmethod
       nmethod* nm = CodeCache::find_nmethod(fst.current()->pc());
@@ -2662,7 +2634,7 @@
   if (!has_last_Java_frame()) return;
   // BiasedLocking needs an updated RegisterMap for the revoke monitors pass
   StackFrameStream fst(this, UseBiasedLocking);
-  for(; !fst.is_done(); fst.next()) {
+  for (; !fst.is_done(); fst.next()) {
     if (fst.current()->should_be_deoptimized()) {
       if (LogCompilation && xtty != NULL) {
         nmethod* nm = fst.current()->cb()->as_nmethod_or_null();
@@ -2722,7 +2694,7 @@
   // Traverse the GCHandles
   Thread::oops_do(f, cld_f, cf);
 
-  assert( (!has_last_Java_frame() && java_call_counter() == 0) ||
+  assert((!has_last_Java_frame() && java_call_counter() == 0) ||
           (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!");
 
   if (has_last_Java_frame()) {
@@ -2747,7 +2719,7 @@
     }
 
     // Traverse the execution stack
-    for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
+    for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
       fst.current()->oops_do(f, cld_f, cf, fst.register_map());
     }
   }
@@ -2782,12 +2754,12 @@
 void JavaThread::nmethods_do(CodeBlobClosure* cf) {
   Thread::nmethods_do(cf);  // (super method is a no-op)
 
-  assert( (!has_last_Java_frame() && java_call_counter() == 0) ||
+  assert((!has_last_Java_frame() && java_call_counter() == 0) ||
           (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!");
 
   if (has_last_Java_frame()) {
     // Traverse the execution stack
-    for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
+    for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
       fst.current()->nmethods_do(cf);
     }
   }
@@ -2797,7 +2769,7 @@
   Thread::metadata_do(f);
   if (has_last_Java_frame()) {
     // Traverse the execution stack to call f() on the methods in the stack
-    for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
+    for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
       fst.current()->metadata_do(f);
     }
   } else if (is_Compiler_thread()) {
@@ -2848,7 +2820,7 @@
   Thread::print_on(st);
   // print guess for valid stack memory region (assume 4K pages); helps lock debugging
   st->print_cr("[" INTPTR_FORMAT "]", (intptr_t)last_Java_sp() & ~right_n_bits(12));
-  if (thread_oop != NULL && JDK_Version::is_gte_jdk15x_version()) {
+  if (thread_oop != NULL) {
     st->print_cr("   java.lang.Thread.State: %s", java_lang_Thread::thread_status_name(thread_oop));
   }
 #ifndef PRODUCT
@@ -2860,7 +2832,7 @@
 // Called by fatal error handler. The difference between this and
 // JavaThread::print() is that we can't grab lock or allocate memory.
 void JavaThread::print_on_error(outputStream* st, char *buf, int buflen) const {
-  st->print("JavaThread \"%s\"",  get_thread_name_string(buf, buflen));
+  st->print("JavaThread \"%s\"", get_thread_name_string(buf, buflen));
   oop thread_obj = threadObj();
   if (thread_obj != NULL) {
      if (java_lang_Thread::is_daemon(thread_obj)) st->print(" daemon");
@@ -3043,7 +3015,7 @@
   RegisterMap reg_map(this);
   vframe* start_vf = last_java_vframe(&reg_map);
   int count = 0;
-  for (vframe* f = start_vf; f; f = f->sender() ) {
+  for (vframe* f = start_vf; f; f = f->sender()) {
     if (f->is_java_frame()) {
       javaVFrame* jvf = javaVFrame::cast(f);
       java_lang_Throwable::print_stack_element(st, jvf->method(), jvf->bci());
@@ -3099,9 +3071,9 @@
 void JavaThread::trace_frames() {
   tty->print_cr("[Describe stack]");
   int frame_no = 1;
-  for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
+  for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
     tty->print("  %d. ", frame_no++);
-    fst.current()->print_value_on(tty,this);
+    fst.current()->print_value_on(tty, this);
     tty->cr();
   }
 }
@@ -3152,7 +3124,7 @@
   PRESERVE_EXCEPTION_MARK;
   FrameValues values;
   int frame_no = 0;
-  for(StackFrameStream fst(this, false); !fst.is_done(); fst.next()) {
+  for (StackFrameStream fst(this, false); !fst.is_done(); fst.next()) {
     fst.current()->describe(values, ++frame_no);
     if (depth == frame_no) break;
   }
@@ -3168,7 +3140,7 @@
 void JavaThread::trace_stack_from(vframe* start_vf) {
   ResourceMark rm;
   int vframe_no = 1;
-  for (vframe* f = start_vf; f; f = f->sender() ) {
+  for (vframe* f = start_vf; f; f = f->sender()) {
     if (f->is_java_frame()) {
       javaVFrame::cast(f)->print_activation(vframe_no++);
     } else {
@@ -3197,7 +3169,7 @@
 javaVFrame* JavaThread::last_java_vframe(RegisterMap *reg_map) {
   assert(reg_map != NULL, "a map must be given");
   frame f = last_frame();
-  for (vframe* vf = vframe::new_vframe(&f, reg_map, this); vf; vf = vf->sender() ) {
+  for (vframe* vf = vframe::new_vframe(&f, reg_map, this); vf; vf = vf->sender()) {
     if (vf->is_java_frame()) return javaVFrame::cast(vf);
   }
   return NULL;
@@ -3319,7 +3291,7 @@
 
   // The VM preresolves methods to these classes. Make sure that they get initialized
   initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK);
-  initialize_class(vmSymbols::java_lang_ref_Finalizer(),  CHECK);
+  initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK);
   call_initializeSystemClass(CHECK);
 
   // get the Java runtime name after java.lang.System is initialized
@@ -3453,7 +3425,7 @@
   main_thread->create_stack_guard_pages();
 
   // Initialize Java-Level synchronization subsystem
-  ObjectMonitor::Initialize() ;
+  ObjectMonitor::Initialize();
 
   // Second phase of bootstrapping, VM is about entering multi-thread mode
   MemTracker::bootstrap_multi_thread();
@@ -3501,7 +3473,7 @@
     }
   }
 
-  assert (Universe::is_fully_initialized(), "not initialized");
+  assert(Universe::is_fully_initialized(), "not initialized");
   if (VerifyDuringStartup) {
     // Make sure we're starting with a clean slate.
     VM_Verify verify_op;
@@ -3927,7 +3899,7 @@
 #endif
   // Wait until we are the last non-daemon thread to execute
   { MutexLocker nu(Threads_lock);
-    while (Threads::number_of_non_daemon_threads() > 1 )
+    while (Threads::number_of_non_daemon_threads() > 1)
       // This wait should make safepoint checks, wait without a timeout,
       // and wait as a suspend-equivalent condition.
       //
@@ -3948,15 +3920,8 @@
   }
   os::wait_for_keypress_at_exit();
 
-  if (JDK_Version::is_jdk12x_version()) {
-    // We are the last thread running, so check if finalizers should be run.
-    // For 1.3 or later this is done in thread->invoke_shutdown_hooks()
-    HandleMark rm(thread);
-    Universe::run_finalizers_on_exit();
-  } else {
-    // run Java level shutdown hooks
-    thread->invoke_shutdown_hooks();
-  }
+  // run Java level shutdown hooks
+  thread->invoke_shutdown_hooks();
 
   before_exit(thread);
 
@@ -3968,14 +3933,8 @@
     // GC vm_operations can get caught at the safepoint, and the
     // heap is unparseable if they are caught. Grab the Heap_lock
     // to prevent this. The GC vm_operations will not be able to
-    // queue until after the vm thread is dead.
-    // After this point, we'll never emerge out of the safepoint before
-    // the VM exits, so concurrent GC threads do not need to be explicitly
-    // stopped; they remain inactive until the process exits.
-    // Note: some concurrent G1 threads may be running during a safepoint,
-    // but these will not be accessing the heap, just some G1-specific side
-    // data structures that are not accessed by any other threads but them
-    // after this point in a terminal safepoint.
+    // queue until after the vm thread is dead. After this point,
+    // we'll never emerge out of the safepoint before the VM exits.
 
     MutexLocker ml(Heap_lock);
 
@@ -4113,7 +4072,7 @@
 bool Threads::includes(JavaThread* p) {
   assert(Threads_lock->is_locked(), "sanity check");
   ALL_JAVA_THREADS(q) {
-    if (q == p ) {
+    if (q == p) {
       return true;
     }
   }
@@ -4398,43 +4357,43 @@
 // cache-coherency traffic.
 
 
-typedef volatile int SpinLockT ;
+typedef volatile int SpinLockT;
 
 void Thread::SpinAcquire (volatile int * adr, const char * LockName) {
   if (Atomic::cmpxchg (1, adr, 0) == 0) {
-     return ;   // normal fast-path return
+     return;   // normal fast-path return
   }
 
   // Slow-path : We've encountered contention -- Spin/Yield/Block strategy.
-  TEVENT (SpinAcquire - ctx) ;
-  int ctr = 0 ;
-  int Yields = 0 ;
+  TEVENT(SpinAcquire - ctx);
+  int ctr = 0;
+  int Yields = 0;
   for (;;) {
      while (*adr != 0) {
-        ++ctr ;
+        ++ctr;
         if ((ctr & 0xFFF) == 0 || !os::is_MP()) {
            if (Yields > 5) {
              os::naked_short_sleep(1);
            } else {
-             os::NakedYield() ;
-             ++Yields ;
+             os::NakedYield();
+             ++Yields;
            }
         } else {
-           SpinPause() ;
+           SpinPause();
         }
      }
-     if (Atomic::cmpxchg (1, adr, 0) == 0) return ;
+     if (Atomic::cmpxchg(1, adr, 0) == 0) return;
   }
 }
 
 void Thread::SpinRelease (volatile int * adr) {
-  assert (*adr != 0, "invariant") ;
-  OrderAccess::fence() ;      // guarantee at least release consistency.
+  assert(*adr != 0, "invariant");
+  OrderAccess::fence();      // guarantee at least release consistency.
   // Roach-motel semantics.
   // It's safe if subsequent LDs and STs float "up" into the critical section,
   // but prior LDs and STs within the critical section can't be allowed
   // to reorder or float past the ST that releases the lock.
-  *adr = 0 ;
+  *adr = 0;
 }
 
 // muxAcquire and muxRelease:
@@ -4487,111 +4446,111 @@
 //
 
 
-typedef volatile intptr_t MutexT ;      // Mux Lock-word
-enum MuxBits { LOCKBIT = 1 } ;
+typedef volatile intptr_t MutexT;      // Mux Lock-word
+enum MuxBits { LOCKBIT = 1 };
 
 void Thread::muxAcquire (volatile intptr_t * Lock, const char * LockName) {
-  intptr_t w = Atomic::cmpxchg_ptr (LOCKBIT, Lock, 0) ;
-  if (w == 0) return ;
+  intptr_t w = Atomic::cmpxchg_ptr(LOCKBIT, Lock, 0);
+  if (w == 0) return;
   if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
-     return ;
+     return;
   }
 
-  TEVENT (muxAcquire - Contention) ;
-  ParkEvent * const Self = Thread::current()->_MuxEvent ;
-  assert ((intptr_t(Self) & LOCKBIT) == 0, "invariant") ;
+  TEVENT(muxAcquire - Contention);
+  ParkEvent * const Self = Thread::current()->_MuxEvent;
+  assert((intptr_t(Self) & LOCKBIT) == 0, "invariant");
   for (;;) {
-     int its = (os::is_MP() ? 100 : 0) + 1 ;
+     int its = (os::is_MP() ? 100 : 0) + 1;
 
      // Optional spin phase: spin-then-park strategy
      while (--its >= 0) {
-       w = *Lock ;
+       w = *Lock;
        if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
-          return ;
+          return;
        }
      }
 
-     Self->reset() ;
-     Self->OnList = intptr_t(Lock) ;
+     Self->reset();
+     Self->OnList = intptr_t(Lock);
      // The following fence() isn't _strictly necessary as the subsequent
      // CAS() both serializes execution and ratifies the fetched *Lock value.
      OrderAccess::fence();
      for (;;) {
-        w = *Lock ;
+        w = *Lock;
         if ((w & LOCKBIT) == 0) {
             if (Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
-                Self->OnList = 0 ;   // hygiene - allows stronger asserts
-                return ;
+                Self->OnList = 0;   // hygiene - allows stronger asserts
+                return;
             }
-            continue ;      // Interference -- *Lock changed -- Just retry
+            continue;      // Interference -- *Lock changed -- Just retry
         }
-        assert (w & LOCKBIT, "invariant") ;
-        Self->ListNext = (ParkEvent *) (w & ~LOCKBIT );
-        if (Atomic::cmpxchg_ptr (intptr_t(Self)|LOCKBIT, Lock, w) == w) break ;
+        assert(w & LOCKBIT, "invariant");
+        Self->ListNext = (ParkEvent *) (w & ~LOCKBIT);
+        if (Atomic::cmpxchg_ptr(intptr_t(Self)|LOCKBIT, Lock, w) == w) break;
      }
 
      while (Self->OnList != 0) {
-        Self->park() ;
+        Self->park();
      }
   }
 }
 
 void Thread::muxAcquireW (volatile intptr_t * Lock, ParkEvent * ev) {
-  intptr_t w = Atomic::cmpxchg_ptr (LOCKBIT, Lock, 0) ;
-  if (w == 0) return ;
+  intptr_t w = Atomic::cmpxchg_ptr(LOCKBIT, Lock, 0);
+  if (w == 0) return;
   if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
-    return ;
+    return;
   }
 
-  TEVENT (muxAcquire - Contention) ;
-  ParkEvent * ReleaseAfter = NULL ;
+  TEVENT(muxAcquire - Contention);
+  ParkEvent * ReleaseAfter = NULL;
   if (ev == NULL) {
-    ev = ReleaseAfter = ParkEvent::Allocate (NULL) ;
+    ev = ReleaseAfter = ParkEvent::Allocate(NULL);
   }
-  assert ((intptr_t(ev) & LOCKBIT) == 0, "invariant") ;
+  assert((intptr_t(ev) & LOCKBIT) == 0, "invariant");
   for (;;) {
-    guarantee (ev->OnList == 0, "invariant") ;
-    int its = (os::is_MP() ? 100 : 0) + 1 ;
+    guarantee(ev->OnList == 0, "invariant");
+    int its = (os::is_MP() ? 100 : 0) + 1;
 
     // Optional spin phase: spin-then-park strategy
     while (--its >= 0) {
-      w = *Lock ;
+      w = *Lock;
       if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
         if (ReleaseAfter != NULL) {
-          ParkEvent::Release (ReleaseAfter) ;
+          ParkEvent::Release(ReleaseAfter);
         }
-        return ;
+        return;
       }
     }
 
-    ev->reset() ;
-    ev->OnList = intptr_t(Lock) ;
+    ev->reset();
+    ev->OnList = intptr_t(Lock);
     // The following fence() isn't _strictly necessary as the subsequent
     // CAS() both serializes execution and ratifies the fetched *Lock value.
     OrderAccess::fence();
     for (;;) {
-      w = *Lock ;
+      w = *Lock;
       if ((w & LOCKBIT) == 0) {
         if (Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
-          ev->OnList = 0 ;
+          ev->OnList = 0;
           // We call ::Release while holding the outer lock, thus
           // artificially lengthening the critical section.
           // Consider deferring the ::Release() until the subsequent unlock(),
           // after we've dropped the outer lock.
           if (ReleaseAfter != NULL) {
-            ParkEvent::Release (ReleaseAfter) ;
+            ParkEvent::Release(ReleaseAfter);
           }
-          return ;
+          return;
         }
-        continue ;      // Interference -- *Lock changed -- Just retry
+        continue;      // Interference -- *Lock changed -- Just retry
       }
-      assert (w & LOCKBIT, "invariant") ;
-      ev->ListNext = (ParkEvent *) (w & ~LOCKBIT );
-      if (Atomic::cmpxchg_ptr (intptr_t(ev)|LOCKBIT, Lock, w) == w) break ;
+      assert(w & LOCKBIT, "invariant");
+      ev->ListNext = (ParkEvent *) (w & ~LOCKBIT);
+      if (Atomic::cmpxchg_ptr(intptr_t(ev)|LOCKBIT, Lock, w) == w) break;
     }
 
     while (ev->OnList != 0) {
-      ev->park() ;
+      ev->park();
     }
   }
 }
@@ -4618,22 +4577,22 @@
 
 void Thread::muxRelease (volatile intptr_t * Lock)  {
   for (;;) {
-    const intptr_t w = Atomic::cmpxchg_ptr (0, Lock, LOCKBIT) ;
-    assert (w & LOCKBIT, "invariant") ;
-    if (w == LOCKBIT) return ;
-    ParkEvent * List = (ParkEvent *) (w & ~LOCKBIT) ;
-    assert (List != NULL, "invariant") ;
-    assert (List->OnList == intptr_t(Lock), "invariant") ;
-    ParkEvent * nxt = List->ListNext ;
+    const intptr_t w = Atomic::cmpxchg_ptr(0, Lock, LOCKBIT);
+    assert(w & LOCKBIT, "invariant");
+    if (w == LOCKBIT) return;
+    ParkEvent * List = (ParkEvent *)(w & ~LOCKBIT);
+    assert(List != NULL, "invariant");
+    assert(List->OnList == intptr_t(Lock), "invariant");
+    ParkEvent * nxt = List->ListNext;
 
     // The following CAS() releases the lock and pops the head element.
     if (Atomic::cmpxchg_ptr (intptr_t(nxt), Lock, w) != w) {
-      continue ;
+      continue;
     }
-    List->OnList = 0 ;
-    OrderAccess::fence() ;
-    List->unpark () ;
-    return ;
+    List->OnList = 0;
+    OrderAccess::fence();
+    List->unpark();
+    return;
   }
 }
 
--- a/hotspot/src/share/vm/runtime/thread.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -244,7 +244,7 @@
   // The two classes No_Safepoint_Verifier and No_Allocation_Verifier are used to set these counters.
   //
   NOT_PRODUCT(int _allow_safepoint_count;)      // If 0, thread allow a safepoint to happen
-  debug_only (int _allow_allocation_count;)     // If 0, the thread is allowed to allocate oops.
+  debug_only(int _allow_allocation_count;)     // If 0, the thread is allowed to allocate oops.
 
   // Used by SkipGCALot class.
   NOT_PRODUCT(bool _skip_gcalot;)               // Should we elide gc-a-lot?
@@ -593,12 +593,12 @@
   bool is_inside_jvmti_env_iteration()           { return _jvmti_env_iteration_count > 0; }
 
   // Code generation
-  static ByteSize exception_file_offset()        { return byte_offset_of(Thread, _exception_file   ); }
-  static ByteSize exception_line_offset()        { return byte_offset_of(Thread, _exception_line   ); }
-  static ByteSize active_handles_offset()        { return byte_offset_of(Thread, _active_handles   ); }
+  static ByteSize exception_file_offset()        { return byte_offset_of(Thread, _exception_file); }
+  static ByteSize exception_line_offset()        { return byte_offset_of(Thread, _exception_line); }
+  static ByteSize active_handles_offset()        { return byte_offset_of(Thread, _active_handles); }
 
-  static ByteSize stack_base_offset()            { return byte_offset_of(Thread, _stack_base ); }
-  static ByteSize stack_size_offset()            { return byte_offset_of(Thread, _stack_size ); }
+  static ByteSize stack_base_offset()            { return byte_offset_of(Thread, _stack_base); }
+  static ByteSize stack_size_offset()            { return byte_offset_of(Thread, _stack_size); }
 
 #define TLAB_FIELD_OFFSET(name) \
   static ByteSize tlab_##name##_offset()         { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::name##_offset(); }
@@ -615,35 +615,35 @@
 
 #undef TLAB_FIELD_OFFSET
 
-  static ByteSize allocated_bytes_offset()       { return byte_offset_of(Thread, _allocated_bytes ); }
+  static ByteSize allocated_bytes_offset()       { return byte_offset_of(Thread, _allocated_bytes); }
 
  public:
-  volatile intptr_t _Stalled ;
-  volatile int _TypeTag ;
-  ParkEvent * _ParkEvent ;                     // for synchronized()
-  ParkEvent * _SleepEvent ;                    // for Thread.sleep
-  ParkEvent * _MutexEvent ;                    // for native internal Mutex/Monitor
-  ParkEvent * _MuxEvent ;                      // for low-level muxAcquire-muxRelease
-  int NativeSyncRecursion ;                    // diagnostic
+  volatile intptr_t _Stalled;
+  volatile int _TypeTag;
+  ParkEvent * _ParkEvent;                     // for synchronized()
+  ParkEvent * _SleepEvent;                    // for Thread.sleep
+  ParkEvent * _MutexEvent;                    // for native internal Mutex/Monitor
+  ParkEvent * _MuxEvent;                      // for low-level muxAcquire-muxRelease
+  int NativeSyncRecursion;                    // diagnostic
 
-  volatile int _OnTrap ;                       // Resume-at IP delta
-  jint _hashStateW ;                           // Marsaglia Shift-XOR thread-local RNG
-  jint _hashStateX ;                           // thread-specific hashCode generator state
-  jint _hashStateY ;
-  jint _hashStateZ ;
-  void * _schedctl ;
+  volatile int _OnTrap;                       // Resume-at IP delta
+  jint _hashStateW;                           // Marsaglia Shift-XOR thread-local RNG
+  jint _hashStateX;                           // thread-specific hashCode generator state
+  jint _hashStateY;
+  jint _hashStateZ;
+  void * _schedctl;
 
 
-  volatile jint rng [4] ;                      // RNG for spin loop
+  volatile jint rng[4];                      // RNG for spin loop
 
   // Low-level leaf-lock primitives used to implement synchronization
   // and native monitor-mutex infrastructure.
   // Not for general synchronization use.
-  static void SpinAcquire (volatile int * Lock, const char * Name) ;
-  static void SpinRelease (volatile int * Lock) ;
-  static void muxAcquire  (volatile intptr_t * Lock, const char * Name) ;
-  static void muxAcquireW (volatile intptr_t * Lock, ParkEvent * ev) ;
-  static void muxRelease  (volatile intptr_t * Lock) ;
+  static void SpinAcquire(volatile int * Lock, const char * Name);
+  static void SpinRelease(volatile int * Lock);
+  static void muxAcquire(volatile intptr_t * Lock, const char * Name);
+  static void muxAcquireW(volatile intptr_t * Lock, ParkEvent * ev);
+  static void muxRelease(volatile intptr_t * Lock);
 };
 
 // Inline implementation of Thread::current()
@@ -915,6 +915,9 @@
   // support for JNI critical regions
   jint    _jni_active_critical;                  // count of entries into JNI critical region
 
+  // Checked JNI: function name requires exception check
+  char* _pending_jni_exception_check_fn;
+
   // For deadlock detection.
   int _depth_first_number;
 
@@ -930,7 +933,7 @@
       intptr_t _instruction;
       const char*  _file;
       int _line;
-  }   _jmp_ring[ jump_ring_buffer_size ];
+  }   _jmp_ring[jump_ring_buffer_size];
 #endif /* PRODUCT */
 
 #if INCLUDE_ALL_GCS
@@ -1333,34 +1336,34 @@
 #endif /* PRODUCT */
 
   // For assembly stub generation
-  static ByteSize threadObj_offset()             { return byte_offset_of(JavaThread, _threadObj           ); }
+  static ByteSize threadObj_offset()             { return byte_offset_of(JavaThread, _threadObj); }
 #ifndef PRODUCT
-  static ByteSize jmp_ring_index_offset()        { return byte_offset_of(JavaThread, _jmp_ring_index      ); }
-  static ByteSize jmp_ring_offset()              { return byte_offset_of(JavaThread, _jmp_ring            ); }
+  static ByteSize jmp_ring_index_offset()        { return byte_offset_of(JavaThread, _jmp_ring_index); }
+  static ByteSize jmp_ring_offset()              { return byte_offset_of(JavaThread, _jmp_ring); }
 #endif /* PRODUCT */
-  static ByteSize jni_environment_offset()       { return byte_offset_of(JavaThread, _jni_environment     ); }
-  static ByteSize last_Java_sp_offset()          {
+  static ByteSize jni_environment_offset()       { return byte_offset_of(JavaThread, _jni_environment); }
+  static ByteSize last_Java_sp_offset() {
     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_sp_offset();
   }
-  static ByteSize last_Java_pc_offset()          {
+  static ByteSize last_Java_pc_offset() {
     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_pc_offset();
   }
-  static ByteSize frame_anchor_offset()          {
+  static ByteSize frame_anchor_offset() {
     return byte_offset_of(JavaThread, _anchor);
   }
-  static ByteSize callee_target_offset()         { return byte_offset_of(JavaThread, _callee_target       ); }
-  static ByteSize vm_result_offset()             { return byte_offset_of(JavaThread, _vm_result           ); }
-  static ByteSize vm_result_2_offset()           { return byte_offset_of(JavaThread, _vm_result_2         ); }
-  static ByteSize thread_state_offset()          { return byte_offset_of(JavaThread, _thread_state        ); }
-  static ByteSize saved_exception_pc_offset()    { return byte_offset_of(JavaThread, _saved_exception_pc  ); }
-  static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread            ); }
-  static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop       ); }
-  static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc        ); }
+  static ByteSize callee_target_offset()         { return byte_offset_of(JavaThread, _callee_target); }
+  static ByteSize vm_result_offset()             { return byte_offset_of(JavaThread, _vm_result); }
+  static ByteSize vm_result_2_offset()           { return byte_offset_of(JavaThread, _vm_result_2); }
+  static ByteSize thread_state_offset()          { return byte_offset_of(JavaThread, _thread_state); }
+  static ByteSize saved_exception_pc_offset()    { return byte_offset_of(JavaThread, _saved_exception_pc); }
+  static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread); }
+  static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop); }
+  static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc); }
   static ByteSize exception_handler_pc_offset()  { return byte_offset_of(JavaThread, _exception_handler_pc); }
   static ByteSize stack_overflow_limit_offset()  { return byte_offset_of(JavaThread, _stack_overflow_limit); }
   static ByteSize is_method_handle_return_offset() { return byte_offset_of(JavaThread, _is_method_handle_return); }
-  static ByteSize stack_guard_state_offset()     { return byte_offset_of(JavaThread, _stack_guard_state   ); }
-  static ByteSize suspend_flags_offset()         { return byte_offset_of(JavaThread, _suspend_flags       ); }
+  static ByteSize stack_guard_state_offset()     { return byte_offset_of(JavaThread, _stack_guard_state); }
+  static ByteSize suspend_flags_offset()         { return byte_offset_of(JavaThread, _suspend_flags); }
 
   static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); }
   static ByteSize should_post_on_exceptions_flag_offset() {
@@ -1400,6 +1403,12 @@
                           assert(_jni_active_critical >= 0,
                                  "JNI critical nesting problem?"); }
 
+  // Checked JNI, is the programmer required to check for exceptions, specify which function name
+  bool is_pending_jni_exception_check() const { return _pending_jni_exception_check_fn != NULL; }
+  void clear_pending_jni_exception_check() { _pending_jni_exception_check_fn = NULL; }
+  const char* get_pending_jni_exception_check() const { return _pending_jni_exception_check_fn; }
+  void set_pending_jni_exception_check(const char* fn_name) { _pending_jni_exception_check_fn = (char*) fn_name; }
+
   // For deadlock detection
   int depth_first_number() { return _depth_first_number; }
   void set_depth_first_number(int dfn) { _depth_first_number = dfn; }
@@ -1413,7 +1422,7 @@
   void remove_monitor_chunk(MonitorChunk* chunk);
   bool in_deopt_handler() const                  { return _in_deopt_handler > 0; }
   void inc_in_deopt_handler()                    { _in_deopt_handler++; }
-  void dec_in_deopt_handler()                    {
+  void dec_in_deopt_handler() {
     assert(_in_deopt_handler > 0, "mismatched deopt nesting");
     if (_in_deopt_handler > 0) { // robustness
       _in_deopt_handler--;
@@ -1767,7 +1776,7 @@
   uint _claimed_par_id;
 public:
   uint get_claimed_par_id() { return _claimed_par_id; }
-  void set_claimed_par_id(uint id) { _claimed_par_id = id;}
+  void set_claimed_par_id(uint id) { _claimed_par_id = id; }
 };
 
 // Inline implementation of JavaThread::current
@@ -1802,7 +1811,7 @@
 inline size_t JavaThread::stack_available(address cur_sp) {
   // This code assumes java stacks grow down
   address low_addr; // Limit on the address for deepest stack depth
-  if ( _stack_guard_state == stack_guard_unused) {
+  if (_stack_guard_state == stack_guard_unused) {
     low_addr =  stack_base() - stack_size();
   } else {
     low_addr = stack_yellow_zone_base();
--- a/hotspot/src/share/vm/runtime/vframe.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vframe.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -480,9 +480,8 @@
 
 void vframeStreamCommon::skip_reflection_related_frames() {
   while (!at_end() &&
-         (JDK_Version::is_gte_jdk14x_version() &&
           (method()->method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) ||
-           method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) {
+           method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass()))) {
     next();
   }
 }
--- a/hotspot/src/share/vm/runtime/vm_operations.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vm_operations.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -184,9 +184,7 @@
   assert(Thread::current()->is_Java_thread(), "just checking");
 
   // Make sure AbstractOwnableSynchronizer is loaded
-  if (JDK_Version::is_gte_jdk16x_version()) {
-    java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
-  }
+  java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
 
   // Get Heap_lock if concurrent locks will be dumped
   if (_print_concurrent_locks) {
@@ -225,7 +223,7 @@
   assert(Thread::current()->is_Java_thread(), "just checking");
 
   // Load AbstractOwnableSynchronizer class
-  if (_concurrent_locks && JDK_Version::is_gte_jdk16x_version()) {
+  if (_concurrent_locks) {
     java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
   }
 
@@ -283,9 +281,7 @@
   assert(Thread::current()->is_Java_thread(), "just checking");
 
   // Load AbstractOwnableSynchronizer class before taking thread snapshots
-  if (JDK_Version::is_gte_jdk16x_version()) {
-    java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
-  }
+  java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
 
   if (_with_locked_synchronizers) {
     // Acquire Heap_lock to dump concurrent locks
--- a/hotspot/src/share/vm/runtime/vm_operations.hpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vm_operations.hpp	Wed Jul 09 10:42:04 2014 -0700
@@ -98,6 +98,7 @@
   template(LinuxDllLoad)                          \
   template(RotateGCLog)                           \
   template(WhiteBoxOperation)                     \
+  template(ClassLoaderStatsOperation)             \
 
 class VM_Operation: public CHeapObj<mtInternal> {
  public:
--- a/hotspot/src/share/vm/runtime/vm_version.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -160,8 +160,7 @@
 #ifdef VENDOR
   return XSTR(VENDOR);
 #else
-  return JDK_Version::is_gte_jdk17x_version() ?
-    "Oracle Corporation" : "Sun Microsystems Inc.";
+  return "Oracle Corporation";
 #endif
 }
 
@@ -222,20 +221,12 @@
 
   #ifndef HOTSPOT_BUILD_COMPILER
     #ifdef _MSC_VER
-      #if   _MSC_VER == 1100
-        #define HOTSPOT_BUILD_COMPILER "MS VC++ 5.0"
-      #elif _MSC_VER == 1200
-        #define HOTSPOT_BUILD_COMPILER "MS VC++ 6.0"
-      #elif _MSC_VER == 1310
-        #define HOTSPOT_BUILD_COMPILER "MS VC++ 7.1 (VS2003)"
-      #elif _MSC_VER == 1400
-        #define HOTSPOT_BUILD_COMPILER "MS VC++ 8.0 (VS2005)"
-      #elif _MSC_VER == 1500
-        #define HOTSPOT_BUILD_COMPILER "MS VC++ 9.0 (VS2008)"
-      #elif _MSC_VER == 1600
+      #if _MSC_VER == 1600
         #define HOTSPOT_BUILD_COMPILER "MS VC++ 10.0 (VS2010)"
       #elif _MSC_VER == 1700
         #define HOTSPOT_BUILD_COMPILER "MS VC++ 11.0 (VS2012)"
+      #elif _MSC_VER == 1800
+        #define HOTSPOT_BUILD_COMPILER "MS VC++ 12.0 (VS2013)"
       #else
         #define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
       #endif
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderStats.hpp"
 #include "gc_implementation/shared/vmGCOperations.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/os.hpp"
@@ -58,6 +59,7 @@
 #endif // INCLUDE_SERVICES
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RotateGCLogDCmd>(full_export, true, false));
+  DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
 
   // Enhanced JMX Agent Support
   // These commands won't be exported via the DiagnosticCommandMBean until an
--- a/hotspot/src/share/vm/services/management.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/services/management.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -1229,10 +1229,8 @@
                "The length of the given ThreadInfo array does not match the length of the given array of thread IDs", -1);
   }
 
-  if (JDK_Version::is_gte_jdk16x_version()) {
-    // make sure the AbstractOwnableSynchronizer klass is loaded before taking thread snapshots
-    java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(CHECK_0);
-  }
+  // make sure the AbstractOwnableSynchronizer klass is loaded before taking thread snapshots
+  java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(CHECK_0);
 
   // Must use ThreadDumpResult to store the ThreadSnapshot.
   // GC may occur after the thread snapshots are taken but before
@@ -1303,10 +1301,8 @@
 JVM_ENTRY(jobjectArray, jmm_DumpThreads(JNIEnv *env, jlongArray thread_ids, jboolean locked_monitors, jboolean locked_synchronizers))
   ResourceMark rm(THREAD);
 
-  if (JDK_Version::is_gte_jdk16x_version()) {
-    // make sure the AbstractOwnableSynchronizer klass is loaded before taking thread snapshots
-    java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(CHECK_NULL);
-  }
+  // make sure the AbstractOwnableSynchronizer klass is loaded before taking thread snapshots
+  java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(CHECK_NULL);
 
   typeArrayOop ta = typeArrayOop(JNIHandles::resolve(thread_ids));
   int num_threads = (ta != NULL ? ta->length() : 0);
--- a/hotspot/src/share/vm/services/threadService.cpp	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/src/share/vm/services/threadService.cpp	Wed Jul 09 10:42:04 2014 -0700
@@ -665,17 +665,15 @@
   // dump all locked concurrent locks
   assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped");
 
-  if (JDK_Version::is_gte_jdk16x_version()) {
-    ResourceMark rm;
+  ResourceMark rm;
 
-    GrowableArray<oop>* aos_objects = new GrowableArray<oop>(INITIAL_ARRAY_SIZE);
+  GrowableArray<oop>* aos_objects = new GrowableArray<oop>(INITIAL_ARRAY_SIZE);
 
-    // Find all instances of AbstractOwnableSynchronizer
-    HeapInspection::find_instances_at_safepoint(SystemDictionary::abstract_ownable_synchronizer_klass(),
+  // Find all instances of AbstractOwnableSynchronizer
+  HeapInspection::find_instances_at_safepoint(SystemDictionary::abstract_ownable_synchronizer_klass(),
                                                 aos_objects);
-    // Build a map of thread to its owned AQS locks
-    build_map(aos_objects);
-  }
+  // Build a map of thread to its owned AQS locks
+  build_map(aos_objects);
 }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/EnclosingMethodAttr/EnclMethTest.jcod	Wed Jul 09 10:42:04 2014 -0700
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ */
+
+/*
+ * This test has a EnclosingMethod attribute with an illegal
+ * attribute_length field value of 6.  This should cause a
+ * java.lang.ClassFormatError exception to be thrown.
+ */
+
+class EnclMethTest {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [22] { // Constant Pool
+    ; // first element is empty
+    Field #3 #14; // #1     at 0x0A
+    Method #4 #15; // #2     at 0x0F
+    class #16; // #3     at 0x14
+    class #19; // #4     at 0x17
+    Utf8 "this$0"; // #5     at 0x1A
+    Utf8 "La;"; // #6     at 0x23
+    Utf8 "Synthetic"; // #7     at 0x29
+    Utf8 "<init>"; // #8     at 0x35
+    Utf8 "(Ljava/lang/Object;)V"; // #9     at 0x3E
+    Utf8 "Code"; // #10     at 0x56
+    Utf8 "LineNumberTable"; // #11     at 0x5D
+    Utf8 "SourceFile"; // #12     at 0x6F
+    Utf8 "a.java"; // #13     at 0x7C
+    NameAndType #5 #6; // #14     at 0x85
+    NameAndType #8 #20; // #15     at 0x8A
+    Utf8 "EnclMethTest"; // #16     at 0x8F
+    Utf8 "Loc"; // #17     at 0x9E
+    Utf8 "InnerClasses"; // #18     at 0xA4
+    Utf8 "java/lang/Object"; // #19     at 0xB3
+    Utf8 "()V"; // #20     at 0xC6
+    Utf8 "EnclosingMethod"; // #21     at 0xCC
+  } // Constant Pool
+
+  0x0000; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [0] { // Interfaces
+  } // Interfaces
+
+  [1] { // fields
+    { // Member at 0xE8
+      0x0000; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [1] { // Attributes
+        Attr(#7, 0) { // Synthetic at 0xF0
+        } // end Synthetic
+      } // Attributes
+    } // Member
+  } // fields
+
+  [1] { // methods
+    { // Member at 0xF8
+      0x0001; // access
+      #8; // name_cpx
+      #20; // sig_cpx
+      [1] { // Attributes
+        Attr(#10, 17) { // Code at 0x0100
+          2; // max_stack
+          2; // max_locals
+          Bytes[5]{
+            0x2AB70002B1;
+          };
+          [0] { // Traps
+          } // end Traps
+          [0] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [3] { // Attributes
+    Attr(#12, 2) { // SourceFile at 0x0119
+      #13;
+    } // end SourceFile
+    ;
+    Attr(#18, 10) { // InnerClasses at 0x0121
+      [1] { // InnerClasses
+        #3 #0 #17 0; //  at 0x0131
+      }
+    } // end InnerClasses
+    ;
+    Attr(#21, 6) { // EnclosingMethod at 0x0131
+      // invalid length of EnclosingMethod attr: 6 (should be 4) !!
+      0x0004000F;
+    } // end EnclosingMethod
+  } // Attributes
+} // end class EnclMethTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java	Wed Jul 09 10:42:04 2014 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8044738
+ * @library /testlibrary
+ * @summary Check attribute_length of EnclosingMethod attribute
+ * @run main EnclMethodAttr
+ */
+
+import java.io.File;
+import com.oracle.java.testlibrary.*;
+
+public class EnclMethodAttr {
+
+    static final String testsrc = System.getProperty("test.src");
+
+    public static void main(String args[]) throws Throwable {
+        System.out.println("Regression test for bug 8044738");
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-jar", testsrc + File.separator + "enclMethodAttr.jar");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("java.lang.ClassFormatError: Wrong EnclosingMethod");
+    }
+}
+
Binary file hotspot/test/runtime/EnclosingMethodAttr/enclMethodAttr.jar has changed
--- a/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java	Wed Jul 09 10:42:04 2014 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug     8036823
+ * @bug     8046287
  * @summary Creates two threads contending for the same lock and checks
  *      whether jstack reports "locked" by more than one thread.
  *
@@ -52,10 +53,13 @@
     // looking for header lines with these patterns:
     // "ContendingThread-1" #19 prio=5 os_prio=64 tid=0x000000000079c000 nid=0x23 runnable [0xffff80ffb8b87000]
     // "ContendingThread-2" #21 prio=5 os_prio=64 tid=0x0000000000780000 nid=0x2f waiting for monitor entry [0xfffffd7fc1111000]
+    // "ContendingThread-2" #24 prio=5 os_prio=64 tid=0x0000000000ec8800 nid=0x31 waiting on condition [0xfffffd7bbfffe000]
     final static Pattern HEADER_PREFIX_PATTERN = Pattern.compile(
         "^\"ContendingThread-.*");
-    final static Pattern HEADER_WAITING_PATTERN = Pattern.compile(
+    final static Pattern HEADER_WAITING_PATTERN1 = Pattern.compile(
         "^\"ContendingThread-.* waiting for monitor entry .*");
+    final static Pattern HEADER_WAITING_PATTERN2 = Pattern.compile(
+        "^\"ContendingThread-.* waiting on condition .*");
     final static Pattern HEADER_RUNNABLE_PATTERN = Pattern.compile(
         "^\"ContendingThread-.* runnable .*");
 
@@ -80,17 +84,34 @@
     final static Pattern WAITING_PATTERN = Pattern.compile(
         ".* waiting to lock \\<.*\\(a TestThreadDumpMonitorContention.*");
 
+    final static Object barrier = new Object();
     volatile static boolean done = false;
 
+    static int barrier_cnt = 0;
+    static int blank_line_match_cnt = 0;
     static int error_cnt = 0;
-    static String header_line = null;
     static boolean have_header_line = false;
     static boolean have_thread_state_line = false;
-    static int match_cnt = 0;
-    static String[] match_list = new String[2];
+    static String header_line = null;
+    static int header_prefix_match_cnt = 0;
+    static int locked_line_match_cnt = 0;
+    static String[] locked_match_list = new String[2];
     static int n_samples = 15;
+    static int sum_both_running_cnt = 0;
+    static int sum_both_waiting_cnt = 0;
+    static int sum_contended_cnt = 0;
+    static int sum_locked_hdr_runnable_cnt = 0;
+    static int sum_locked_hdr_waiting1_cnt = 0;
+    static int sum_locked_hdr_waiting2_cnt = 0;
+    static int sum_locked_thr_state_blocked_cnt = 0;
+    static int sum_locked_thr_state_runnable_cnt = 0;
+    static int sum_one_waiting_cnt = 0;
+    static int sum_uncontended_cnt = 0;
+    static int sum_waiting_hdr_waiting1_cnt = 0;
+    static int sum_waiting_thr_state_blocked_cnt = 0;
     static String thread_state_line = null;
     static boolean verbose = false;
+    static int waiting_line_match_cnt = 0;
 
     public static void main(String[] args) throws Exception {
         if (args.length != 0) {
@@ -110,6 +131,11 @@
 
         Runnable runnable = new Runnable() {
             public void run() {
+                synchronized (barrier) {
+                    // let the main thread know we're running
+                    barrier_cnt++;
+                    barrier.notify();
+                }
                 while (!done) {
                     synchronized (this) { }
                 }
@@ -118,8 +144,16 @@
         Thread[] thread_list = new Thread[2];
         thread_list[0] = new Thread(runnable, "ContendingThread-1");
         thread_list[1] = new Thread(runnable, "ContendingThread-2");
-        thread_list[0].start();
-        thread_list[1].start();
+        synchronized (barrier) {
+            thread_list[0].start();
+            thread_list[1].start();
+
+            // Wait until the contending threads are running so that
+            // we don't sample any thread init states.
+            while (barrier_cnt < 2) {
+                barrier.wait();
+            }
+        }
 
         doSamples();
 
@@ -143,11 +177,12 @@
     // Example:
     // "ContendingThread-1" #21 prio=5 os_prio=64 tid=0x00000000007b9000 nid=0x2f runnable [0xfffffd7fc1111000]
     //    java.lang.Thread.State: RUNNABLE
-    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:67)
+    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
     //         at java.lang.Thread.run(Thread.java:745)
     //
     static boolean checkBlankLine(String line) {
         if (line.length() == 0) {
+            blank_line_match_cnt++;
             have_header_line = false;
             have_thread_state_line = false;
             return true;
@@ -161,49 +196,73 @@
     // Example 1:
     // "ContendingThread-1" #21 prio=5 os_prio=64 tid=0x00000000007b9000 nid=0x2f runnable [0xfffffd7fc1111000]
     //    java.lang.Thread.State: RUNNABLE
-    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:67)
+    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
     //         - locked <0xfffffd7e6a2912f8> (a TestThreadDumpMonitorContention$1)
     //         at java.lang.Thread.run(Thread.java:745)
     //
     // Example 2:
     // "ContendingThread-1" #21 prio=5 os_prio=64 tid=0x00000000007b9000 nid=0x2f waiting for monitor entry [0xfffffd7fc1111000]
     //    java.lang.Thread.State: BLOCKED (on object monitor)
-    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:67)
+    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
     //         - locked <0xfffffd7e6a2912f8> (a TestThreadDumpMonitorContention$1)
     //         at java.lang.Thread.run(Thread.java:745)
     //
+    // Example 3:
+    // "ContendingThread-2" #24 prio=5 os_prio=64 tid=0x0000000000ec8800 nid=0x31 waiting on condition [0xfffffd7bbfffe000]
+    //    java.lang.Thread.State: RUNNABLE
+    //    JavaThread state: _thread_blocked
+    // Thread: 0x0000000000ec8800  [0x31] State: _at_safepoint _has_called_back 0 _at_poll_safepoint 0
+    //    JavaThread state: _thread_blocked
+    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
+    //         - locked <0xfffffd7e6d03eb28> (a TestThreadDumpMonitorContention$1)
+    //         at java.lang.Thread.run(Thread.java:745)
+    //
     static boolean checkLockedLine(String line) {
         Matcher matcher = LOCK_PATTERN.matcher(line);
         if (matcher.matches()) {
             if (verbose) {
                 System.out.println("locked_line='" + line + "'");
             }
-            match_list[match_cnt] = new String(line);
-            match_cnt++;
+            locked_match_list[locked_line_match_cnt] = new String(line);
+            locked_line_match_cnt++;
 
             matcher = HEADER_RUNNABLE_PATTERN.matcher(header_line);
-            if (!matcher.matches()) {
+            if (matcher.matches()) {
+                sum_locked_hdr_runnable_cnt++;
+            } else {
                 // It's strange, but a locked line can also
-                // match the HEADER_WAITING_PATTERN.
-                matcher = HEADER_WAITING_PATTERN.matcher(header_line);
-                if (!matcher.matches()) {
-                    System.err.println();
-                    System.err.println("ERROR: header line does " +
-                        "not match runnable or waiting patterns.");
-                    System.err.println("ERROR: header_line='" +
-                        header_line + "'");
-                    System.err.println("ERROR: locked_line='" + line + "'");
-                    error_cnt++;
+                // match the HEADER_WAITING_PATTERN{1,2}.
+                matcher = HEADER_WAITING_PATTERN1.matcher(header_line);
+                if (matcher.matches()) {
+                    sum_locked_hdr_waiting1_cnt++;
+                } else {
+                    matcher = HEADER_WAITING_PATTERN2.matcher(header_line);
+                    if (matcher.matches()) {
+                        sum_locked_hdr_waiting2_cnt++;
+                    } else {
+                        System.err.println();
+                        System.err.println("ERROR: header line does " +
+                            "not match runnable or waiting patterns.");
+                        System.err.println("ERROR: header_line='" +
+                            header_line + "'");
+                        System.err.println("ERROR: locked_line='" + line +
+                            "'");
+                        error_cnt++;
+                    }
                 }
             }
 
             matcher = THREAD_STATE_RUNNABLE_PATTERN.matcher(thread_state_line);
-            if (!matcher.matches()) {
+            if (matcher.matches()) {
+                sum_locked_thr_state_runnable_cnt++;
+            } else {
                 // It's strange, but a locked line can also
                 // match the THREAD_STATE_BLOCKED_PATTERN.
                 matcher = THREAD_STATE_BLOCKED_PATTERN.matcher(
                               thread_state_line);
-                if (!matcher.matches()) {
+                if (matcher.matches()) {
+                    sum_locked_thr_state_blocked_cnt++;
+                } else {
                     System.err.println();
                     System.err.println("ERROR: thread state line does not " +
                         "match runnable or waiting patterns.");
@@ -229,19 +288,22 @@
     // Example:
     // "ContendingThread-2" #22 prio=5 os_prio=64 tid=0x00000000007b9800 nid=0x30 waiting for monitor entry [0xfffffd7fc1010000]
     //    java.lang.Thread.State: BLOCKED (on object monitor)
-    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:67)
+    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
     //         - waiting to lock <0xfffffd7e6a2912f8> (a TestThreadDumpMonitorContention$1)
     //         at java.lang.Thread.run(Thread.java:745)
     //
     static boolean checkWaitingLine(String line) {
         Matcher matcher = WAITING_PATTERN.matcher(line);
         if (matcher.matches()) {
+            waiting_line_match_cnt++;
             if (verbose) {
                 System.out.println("waiting_line='" + line + "'");
             }
 
-            matcher = HEADER_WAITING_PATTERN.matcher(header_line);
-            if (!matcher.matches()) {
+            matcher = HEADER_WAITING_PATTERN1.matcher(header_line);
+            if (matcher.matches()) {
+                sum_waiting_hdr_waiting1_cnt++;
+            } else {
                 System.err.println();
                 System.err.println("ERROR: header line does " +
                     "not match a waiting pattern.");
@@ -251,7 +313,9 @@
             }
 
             matcher = THREAD_STATE_BLOCKED_PATTERN.matcher(thread_state_line);
-            if (!matcher.matches()) {
+            if (matcher.matches()) {
+                sum_waiting_thr_state_blocked_cnt++;
+            } else {
                 System.err.println();
                 System.err.println("ERROR: thread state line " +
                     "does not match a waiting pattern.");
@@ -273,7 +337,10 @@
 
     static void doSamples() throws Exception {
         for (int count = 0; count < n_samples; count++) {
-            match_cnt = 0;
+            blank_line_match_cnt = 0;
+            header_prefix_match_cnt = 0;
+            locked_line_match_cnt = 0;
+            waiting_line_match_cnt = 0;
             // verbose mode or an error has a lot of output so add more space
             if (verbose || error_cnt > 0) System.out.println();
             System.out.println("Sample #" + count);
@@ -290,12 +357,12 @@
             //   a failure and we report it
             // - for a stack trace that matches LOCKED_PATTERN, we verify:
             //   - the header line matches HEADER_RUNNABLE_PATTERN
-            //     or HEADER_WAITING_PATTERN
+            //     or HEADER_WAITING_PATTERN{1,2}
             //   - the thread state line matches THREAD_STATE_BLOCKED_PATTERN
             //     or THREAD_STATE_RUNNABLE_PATTERN
             //   - we report any mismatches as failures
             // - for a stack trace that matches WAITING_PATTERN, we verify:
-            //   - the header line matches HEADER_WAITING_PATTERN
+            //   - the header line matches HEADER_WAITING_PATTERN1
             //   - the thread state line matches THREAD_STATE_BLOCKED_PATTERN
             //   - we report any mismatches as failures
             // - the stack traces that match HEADER_PREFIX_PATTERN may
@@ -324,6 +391,7 @@
                 if (!have_header_line) {
                     matcher = HEADER_PREFIX_PATTERN.matcher(line);
                     if (matcher.matches()) {
+                        header_prefix_match_cnt++;
                         if (verbose) {
                             System.out.println();
                             System.out.println("header='" + line + "'");
@@ -366,19 +434,80 @@
             }
             process.waitFor();
 
-           if (match_cnt == 2) {
-               if (match_list[0].equals(match_list[1])) {
-                   System.err.println();
-                   System.err.println("ERROR: matching lock lines:");
-                   System.err.println("ERROR: line[0]'" + match_list[0] + "'");
-                   System.err.println("ERROR: line[1]'" + match_list[1] + "'");
-                   error_cnt++;
-               }
-           }
+            if (header_prefix_match_cnt != 2) {
+                System.err.println();
+                System.err.println("ERROR: should match exactly two headers.");
+                System.err.println("ERROR: header_prefix_match_cnt=" +
+                    header_prefix_match_cnt);
+                error_cnt++;
+            }
+
+            if (locked_line_match_cnt == 2) {
+                if (locked_match_list[0].equals(locked_match_list[1])) {
+                    System.err.println();
+                    System.err.println("ERROR: matching lock lines:");
+                    System.err.println("ERROR: line[0]'" +
+                        locked_match_list[0] + "'");
+                    System.err.println("ERROR: line[1]'" +
+                        locked_match_list[1] + "'");
+                    error_cnt++;
+                }
+            }
+
+            if (locked_line_match_cnt == 1) {
+                // one thread has the lock
+                if (waiting_line_match_cnt == 1) {
+                    // and the other contended for it
+                    sum_contended_cnt++;
+                } else {
+                    // and the other is just running
+                    sum_uncontended_cnt++;
+                }
+            } else if (waiting_line_match_cnt == 1) {
+                // one thread is waiting
+                sum_one_waiting_cnt++;
+            } else if (waiting_line_match_cnt == 2) {
+                // both threads are waiting
+                sum_both_waiting_cnt++;
+            } else {
+                // both threads are running
+                sum_both_running_cnt++;
+            }
 
             // slight delay between jstack launches
             Thread.sleep(500);
         }
+
+        if (error_cnt != 0) {
+            // skip summary info since there were errors
+            return;
+        }
+
+        System.out.println("INFO: Summary for all samples:");
+        System.out.println("INFO: both_running_cnt=" + sum_both_running_cnt);
+        System.out.println("INFO: both_waiting_cnt=" + sum_both_waiting_cnt);
+        System.out.println("INFO: contended_cnt=" + sum_contended_cnt);
+        System.out.println("INFO: one_waiting_cnt=" + sum_one_waiting_cnt);
+        System.out.println("INFO: uncontended_cnt=" + sum_uncontended_cnt);
+        System.out.println("INFO: locked_hdr_runnable_cnt=" +
+            sum_locked_hdr_runnable_cnt);
+        System.out.println("INFO: locked_hdr_waiting1_cnt=" +
+            sum_locked_hdr_waiting1_cnt);
+        System.out.println("INFO: locked_hdr_waiting2_cnt=" +
+            sum_locked_hdr_waiting2_cnt);
+        System.out.println("INFO: locked_thr_state_blocked_cnt=" +
+            sum_locked_thr_state_blocked_cnt);
+        System.out.println("INFO: locked_thr_state_runnable_cnt=" +
+            sum_locked_thr_state_runnable_cnt);
+        System.out.println("INFO: waiting_hdr_waiting1_cnt=" +
+            sum_waiting_hdr_waiting1_cnt);
+        System.out.println("INFO: waiting_thr_state_blocked_cnt=" +
+            sum_waiting_thr_state_blocked_cnt);
+
+        if (sum_contended_cnt == 0) {
+            System.err.println("WARNING: the primary scenario for 8036823" +
+                " has not been exercised by this test run.");
+        }
     }
 
     // This helper relies on RuntimeMXBean.getName() returning a string
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/dcmd/ClassLoaderStatsTest.java	Wed Jul 09 10:42:04 2014 -0700
@@ -0,0 +1,155 @@
+/*
+ * 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
+ *
+ * @build ClassLoaderStatsTest DcmdUtil
+ * @run main ClassLoaderStatsTest
+ */
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.StringReader;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class ClassLoaderStatsTest {
+
+    // ClassLoader         Parent              CLD*               Classes   ChunkSz   BlockSz  Type
+    // 0x00000007c0215928  0x0000000000000000  0x0000000000000000       0         0         0  org.eclipse.osgi.baseadaptor.BaseAdaptor$1
+    // 0x00000007c0009868  0x0000000000000000  0x00007fc52aebcc80       1      6144      3768  sun.reflect.DelegatingClassLoader
+    // 0x00000007c0009868  0x0000000000000000  0x00007fc52b8916d0       1      6144      3688  sun.reflect.DelegatingClassLoader
+    // 0x00000007c0009868  0x00000007c0038ba8  0x00007fc52afb8760       1      6144      3688  sun.reflect.DelegatingClassLoader
+    // 0x00000007c0009868  0x0000000000000000  0x00007fc52afbb1a0       1      6144      3688  sun.reflect.DelegatingClassLoader
+    // 0x0000000000000000  0x0000000000000000  0x00007fc523416070    5019  30060544  29956216  <boot classloader>
+    //                                                                455   1210368    672848   + unsafe anonymous classes
+    // 0x00000007c016b5c8  0x00000007c0038ba8  0x00007fc52a995000       5      8192      5864  org.netbeans.StandardModule$OneModuleClassLoader
+    // 0x00000007c0009868  0x00000007c016b5c8  0x00007fc52ac13640       1      6144      3896  sun.reflect.DelegatingClassLoader
+    // ...
+
+    static Pattern clLine = Pattern.compile("0x\\p{XDigit}*\\s*0x\\p{XDigit}*\\s*0x\\p{XDigit}*\\s*(\\d*)\\s*(\\d*)\\s*(\\d*)\\s*(.*)");
+    static Pattern anonLine = Pattern.compile("\\s*(\\d*)\\s*(\\d*)\\s*(\\d*)\\s*.*");
+
+    public static DummyClassLoader dummyloader;
+
+    public static void main(String arg[]) throws Exception {
+
+        // create a classloader and load our special class
+        dummyloader = new DummyClassLoader();
+        Class<?> c = Class.forName("TestClass", true, dummyloader);
+        if (c.getClassLoader() != dummyloader) {
+            throw new RuntimeException("TestClass defined by wrong classloader: " + c.getClassLoader());
+        }
+
+        String result = DcmdUtil.executeDcmd("VM.classloader_stats");
+        BufferedReader r = new BufferedReader(new StringReader(result));
+        String line;
+        while((line = r.readLine()) != null) {
+            Matcher m = clLine.matcher(line);
+            if (m.matches()) {
+                // verify that DummyClassLoader has loaded 1 class and 1 anonymous class
+                if (m.group(4).equals("ClassLoaderStatsTest$DummyClassLoader")) {
+                    System.out.println("line: " + line);
+                    if (!m.group(1).equals("1")) {
+                        throw new Exception("Should have loaded 1 class: " + line);
+                    }
+                    checkPositiveInt(m.group(2));
+                    checkPositiveInt(m.group(3));
+
+                    String next = r.readLine();
+                    System.out.println("next: " + next);
+                    Matcher m1 = anonLine.matcher(next);
+                    m1.matches();
+                    if (!m1.group(1).equals("1")) {
+                        throw new Exception("Should have loaded 1 anonymous class, but found : " + m1.group(1));
+                    }
+                    checkPositiveInt(m1.group(2));
+                    checkPositiveInt(m1.group(3));
+                }
+            }
+        }
+    }
+
+    private static void checkPositiveInt(String s) throws Exception {
+        if (Integer.parseInt(s) <= 0) {
+            throw new Exception("Value should have been > 0: " + s);
+        }
+    }
+
+    public static class DummyClassLoader extends ClassLoader {
+
+        public static final String CLASS_NAME = "TestClass";
+
+        static ByteBuffer readClassFile(String name)
+        {
+            File f = new File(System.getProperty("test.classes", "."),
+                              name);
+            try (FileInputStream fin = new FileInputStream(f);
+                 FileChannel fc = fin.getChannel())
+            {
+                return fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+            } catch (IOException e) {
+                throw new RuntimeException("Can't open file: " + name, e);
+            }
+        }
+
+        protected Class<?> loadClass(String name, boolean resolve)
+            throws ClassNotFoundException
+        {
+            Class<?> c;
+            if (!"TestClass".equals(name)) {
+                c = super.loadClass(name, resolve);
+            } else {
+                // should not delegate to the system class loader
+                c = findClass(name);
+                if (resolve) {
+                    resolveClass(c);
+                }
+            }
+            return c;
+        }
+
+        protected Class<?> findClass(String name)
+            throws ClassNotFoundException
+        {
+            if (!"TestClass".equals(name)) {
+                throw new ClassNotFoundException("Unexpected class: " + name);
+            }
+            return defineClass(name, readClassFile(name + ".class"), null);
+        }
+    } /* DummyClassLoader */
+
+}
+
+class TestClass {
+    static {
+        // force creation of anonymous class (for the lambdaform)
+        Runnable r = () -> System.out.println("Hello");
+        r.run();
+    }
+}
--- a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java	Wed Jul 09 10:42:04 2014 -0700
@@ -26,6 +26,7 @@
  * @bug 8028623
  * @summary Test hashing of extended characters in Serviceability Agent.
  * @library /testlibrary
+ * @ignore 8044416
  * @build com.oracle.java.testlibrary.*
  * @compile -encoding utf8 Test8028623.java
  * @run main Test8028623
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java	Thu Jul 03 11:36:49 2014 -0700
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java	Wed Jul 09 10:42:04 2014 -0700
@@ -25,7 +25,7 @@
  * @test BooleanTest
  * @bug 8028756
  * @library /testlibrary /testlibrary/whitebox
- * @build BooleanTest
+ * @build BooleanTest ClassFileInstaller sun.hotspot.WhiteBox com.oracle.java.testlibrary.*
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI BooleanTest
  * @summary testing of WB::set/getBooleanVMFlag()