changeset 25260:c3d41da9a06b

Merge
author duke
date Wed, 05 Jul 2017 19:48:18 +0200
parents aa64bc1a97d9 0473af8356ac
children 63462542a6a8
files jdk/make/src/classes/build/tools/tzdb/ChronoField.java jdk/make/src/classes/build/tools/tzdb/DateTimeException.java jdk/make/src/classes/build/tools/tzdb/LocalDate.java jdk/make/src/classes/build/tools/tzdb/LocalDateTime.java jdk/make/src/classes/build/tools/tzdb/LocalTime.java jdk/make/src/classes/build/tools/tzdb/TimeDefinition.java jdk/make/src/classes/build/tools/tzdb/Utils.java jdk/make/src/classes/build/tools/tzdb/ZoneOffset.java jdk/make/src/classes/build/tools/tzdb/ZoneOffsetTransition.java jdk/make/src/classes/build/tools/tzdb/ZoneOffsetTransitionRule.java jdk/make/src/classes/build/tools/tzdb/ZoneRulesBuilder.java jdk/src/macosx/native/com/apple/laf/ScreenPopupFactory.m jdk/src/macosx/native/jobjc/JObjC.xcodeproj/default.pbxuser jdk/src/macosx/native/jobjc/JObjC.xcodeproj/project.pbxproj jdk/src/macosx/native/jobjc/README.txt jdk/src/macosx/native/jobjc/TODOS jdk/src/macosx/native/jobjc/bridgesupport.gmk jdk/src/macosx/native/jobjc/build.xml jdk/src/macosx/native/jobjc/extract_classes.pl jdk/src/macosx/native/jobjc/run-and-write-if-okay jdk/src/macosx/native/jobjc/rungen jdk/src/macosx/native/jobjc/runjava jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CFType.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CIF.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Coder.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/FFIType.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Function.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/ID.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Invoke.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/JObjCRuntime.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/MacOSXFramework.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NSClass.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeArgumentBuffer.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeBuffer.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeObjectLifecycleManager.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Opaque.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Pointer.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/PrimitiveCoder.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/SEL.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Struct.java jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Subclassing.java jdk/src/macosx/native/jobjc/src/core/native/CIF.m jdk/src/macosx/native/jobjc/src/core/native/Coder.m jdk/src/macosx/native/jobjc/src/core/native/FFIType.m jdk/src/macosx/native/jobjc/src/core/native/Function.m jdk/src/macosx/native/jobjc/src/core/native/ID.m jdk/src/macosx/native/jobjc/src/core/native/Invoke.m jdk/src/macosx/native/jobjc/src/core/native/JObjCRuntime.m jdk/src/macosx/native/jobjc/src/core/native/MacOSXFramework.m jdk/src/macosx/native/jobjc/src/core/native/NSClass.m jdk/src/macosx/native/jobjc/src/core/native/NativeBuffer.h jdk/src/macosx/native/jobjc/src/core/native/NativeBuffer.m jdk/src/macosx/native/jobjc/src/core/native/NativeObjectLifecycleManager.m jdk/src/macosx/native/jobjc/src/core/native/SEL.m jdk/src/macosx/native/jobjc/src/core/native/Subclassing.m jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/BootClassPathMinus.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/ClassConsolidator.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/ClassGenerator.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FileCopier.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FrameworkGenerator.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FunctionGenerator.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/Generator.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/MethodDisambiguator.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/RestrictedKeywords.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/Utils.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/AbstractObjCClassFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CFTypeClassFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CategoryClassClassFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CategoryClassFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CopiedFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/FrameworkClassFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/GeneratedClassFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/JObjCClassClassFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/JObjCClassFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/MixedPrimitiveCoderClassFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/OpaqueClassFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/OutputFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/RootJObjCClass.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/StructClassFile.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Arg.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/CFType.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Category.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Clazz.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Constant.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Element.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/ElementWType.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Framework.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Function.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/FunctionAlias.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/InformalProtocol.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Method.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/NativeEnum.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Opaque.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/OutputFileGenerator.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Protocol.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/ReturnValue.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/StringConstant.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Struct.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/TypeElement.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/CoderDescriptor.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/ComplexCoderDescriptor.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/PrimitiveCoderDescriptor.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/JType.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/NType.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/Type.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/TypeCache.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/TypeToJType.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/Fp.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/JavaLang.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypeMerger.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypeParser.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypePrinter.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/ObjectInspector.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/QA.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StringStream.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StructOffsetResolver.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StructOffsetResolverBigBang.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/jobjc/SuperClassExtractor.java jdk/src/macosx/native/jobjc/src/generator/java/com/apple/jobjc/UnsafeRuntimeAccess.java jdk/src/macosx/native/jobjc/src/runtime-additions/java/com/apple/jobjc/Utils.java jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeNumber.m jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeString.m jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeThread.m jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BaseBench.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchFunCall.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchIDPop.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchStructCoding.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchUnsafe.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/CategoryTest.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/FunctionTest.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/GUIDemo.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/IBDemo.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/IntroTest.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NSClassTest.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NativeBufferTest.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NativeTypeTest.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/PooledTestCase.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/SELTest.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/StructTest.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/SubclassingTest.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/TestUtils.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/UtilsTest.java jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/VarArgsTest.java jdk/src/macosx/native/jobjc/src/tests/native/FunCallBench.m jdk/src/share/classes/com/sun/java/browser/dom/DOMAccessException.java jdk/src/share/classes/com/sun/java/browser/dom/DOMAccessor.java jdk/src/share/classes/com/sun/java/browser/dom/DOMAction.java jdk/src/share/classes/com/sun/java/browser/dom/DOMService.java jdk/src/share/classes/com/sun/java/browser/dom/DOMServiceProvider.java jdk/src/share/classes/com/sun/java/browser/dom/DOMUnsupportedException.java jdk/src/share/classes/com/sun/java/browser/net/ProxyInfo.java jdk/src/share/classes/com/sun/java/browser/net/ProxyService.java jdk/src/share/classes/com/sun/java/browser/net/ProxyServiceProvider.java jdk/src/share/classes/com/sun/media/sound/services/linux-i586/javax.sound.sampled.spi.MixerProvider jdk/src/share/classes/com/sun/media/sound/services/windows-i586/javax.sound.sampled.spi.MixerProvider jdk/src/share/classes/com/sun/media/sound/services/windows-ia64/javax.sound.sampled.spi.MixerProvider jdk/src/share/classes/sun/awt/EventQueueDelegate.java jdk/src/share/classes/sun/jvmstat/monitor/remote/BufferedMonitoredVm.java jdk/src/share/classes/sun/text/CodePointIterator.java jdk/test/com/sun/jdi/ProcessAttachDebuggee.java jdk/test/com/sun/jdi/ProcessAttachDebugger.java jdk/test/com/sun/jdi/ProcessAttachTest.sh jdk/test/com/sun/jdi/ShutdownDebuggee.java jdk/test/com/sun/jdi/SuspendNoFlagTest.sh jdk/test/com/sun/tools/attach/Shutdown.java jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/AbsoluteComponentCenterCalculator.java jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/DataFlavorSearcher.java jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/InterprocessMessages.java jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MyTransferable.java jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/NextFramePositionCalculator.java jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/SourcePanel.java jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/TargetPanel.java jdk/test/java/awt/EventQueue/6638195/bug6638195.java jdk/test/java/awt/datatransfer/DuplicatedNativesTest/DuplicatedNativesTest.java jdk/test/java/awt/datatransfer/MappingGenerationTest/MappingGenerationTest.java jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh jdk/test/sun/jvmstat/testlibrary/JavaProcess.java
diffstat 1258 files changed, 45726 insertions(+), 30775 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags-top-repo	Wed Jul 09 10:41:34 2014 -0700
+++ b/.hgtags-top-repo	Wed Jul 05 19:48:18 2017 +0200
@@ -263,3 +263,4 @@
 65abab59f783fcf02ff8e133431c252f9e5f07d5 jdk9-b18
 75a08df650eb3126bab0c4d15241f5886162393c jdk9-b19
 ee4fd72b2ec3d92497f37163352f294aa695c6fb jdk9-b20
+9052803f4d01feda28b3d65f2b64dd457d21c7b6 jdk9-b21
--- a/common/autoconf/basics.m4	Wed Jul 09 10:41:34 2014 -0700
+++ b/common/autoconf/basics.m4	Wed Jul 05 19:48:18 2017 +0200
@@ -512,7 +512,7 @@
   )
 
   AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot],
-      [use this directory as sysroot)])],
+      [use this directory as sysroot])],
       [SYSROOT=$with_sysroot]
   )
 
@@ -531,6 +531,75 @@
       [BASIC_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)]
   )
 
+  if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
+    # detect if Xcode is installed by running xcodebuild -version
+    # if no Xcode installed, xcodebuild exits with 1
+    # if Xcode is installed, even if xcode-select is misconfigured, then it exits with 0
+    if /usr/bin/xcodebuild -version >/dev/null 2>&1; then
+      # We need to use xcodebuild in the toolchain dir provided by the user, this will
+      # fall back on the stub binary in /usr/bin/xcodebuild
+      AC_PATH_PROG([XCODEBUILD], [xcodebuild], [/usr/bin/xcodebuild], [$TOOLCHAIN_PATH])
+    else
+      # this should result in SYSROOT being empty, unless --with-sysroot is provided
+      # when only the command line tools are installed there are no SDKs, so headers
+      # are copied into the system frameworks
+      XCODEBUILD=
+      AC_SUBST(XCODEBUILD)
+    fi
+  
+    AC_MSG_CHECKING([for sdk name])
+    AC_ARG_WITH([sdk-name], [AS_HELP_STRING([--with-sdk-name],
+        [use the platform SDK of the given name. @<:@macosx@:>@])],
+        [SDKNAME=$with_sdk_name]
+    )
+    AC_MSG_RESULT([$SDKNAME])
+
+    # if toolchain path is specified then don't rely on system headers, they may not compile
+    HAVE_SYSTEM_FRAMEWORK_HEADERS=0
+    test -z "$TOOLCHAIN_PATH" && \
+      HAVE_SYSTEM_FRAMEWORK_HEADERS=`test ! -f /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h; echo $?`
+
+    if test -z "$SYSROOT"; then
+      if test -n "$XCODEBUILD"; then
+        # if we don't have system headers, use default SDK name (last resort)
+        if test -z "$SDKNAME" -a $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
+          SDKNAME=${SDKNAME:-macosx}
+        fi
+
+        if test -n "$SDKNAME"; then
+          # Call xcodebuild to determine SYSROOT
+          SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | grep '^Path: ' | sed 's/Path: //'`
+        fi
+      else
+        if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
+          AC_MSG_ERROR([No xcodebuild tool and no system framework headers found, use --with-sysroot or --with-sdk-name to provide a path to a valid SDK])
+        fi
+      fi
+    else
+      # warn user if --with-sdk-name was also set
+      if test -n "$with_sdk_name"; then
+        AC_MSG_WARN([Both SYSROOT and --with-sdk-name are set, only SYSROOT will be used])
+      fi
+    fi
+
+    if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0 -a -z "$SYSROOT"; then
+      # If no system framework headers, then SYSROOT must be set, or we won't build
+      AC_MSG_ERROR([Unable to determine SYSROOT and no headers found in /System/Library/Frameworks. Check Xcode configuration, --with-sysroot or --with-sdk-name arguments.])
+    fi
+
+    # Perform a basic sanity test
+    if test ! -f "$SYSROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
+      if test -z "$SYSROOT"; then
+        AC_MSG_ERROR([Unable to find required framework headers, provide a path to an SDK via --with-sysroot or --with-sdk-name and be sure Xcode is installed properly])
+      else
+        AC_MSG_ERROR([Invalid SDK or SYSROOT path, dependent framework headers not found])
+      fi
+    fi
+
+    # set SDKROOT too, Xcode tools will pick it up
+    AC_SUBST(SDKROOT,$SYSROOT)
+  fi
+
   # Prepend the extra path to the global path
   BASIC_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
 
--- a/common/autoconf/flags.m4	Wed Jul 09 10:41:34 2014 -0700
+++ b/common/autoconf/flags.m4	Wed Jul 05 19:48:18 2017 +0200
@@ -131,6 +131,10 @@
             -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
             -L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
       fi
+    elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
+      # Apple only wants -isysroot <path>, but we also need -iframework<path>/System/Library/Frameworks
+      SYSROOT_CFLAGS="-isysroot \"$SYSROOT\" -iframework\"$SYSROOT/System/Library/Frameworks\""
+      SYSROOT_LDFLAGS=$SYSROOT_CFLAGS
     elif test "x$TOOLCHAIN_TYPE" = xgcc; then
       SYSROOT_CFLAGS="--sysroot=\"$SYSROOT\""
       SYSROOT_LDFLAGS="--sysroot=\"$SYSROOT\""
@@ -143,6 +147,14 @@
     LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $SYSROOT_CFLAGS"
     LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $SYSROOT_LDFLAGS"
   fi
+
+  # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
+  # set this here so it doesn't have to be peppered throughout the forest
+  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    SYSROOT_CFLAGS="$SYSROOT_CFLAGS -F\"$SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks\""
+    SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -F\"$SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks\""
+  fi
+
   AC_SUBST(SYSROOT_CFLAGS)
   AC_SUBST(SYSROOT_LDFLAGS)
 ])
@@ -644,23 +656,18 @@
 
   # Additional macosx handling
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    if test "x$TOOLCHAIN_TYPE" = xgcc; then
-      # FIXME: This needs to be exported in spec.gmk due to closed legacy code.
-      # FIXME: clean this up, and/or move it elsewhere.
+    # Setting these parameters makes it an error to link to macosx APIs that are
+    # newer than the given OS version and makes the linked binaries compatible
+    # even if built on a newer version of the OS.
+    # The expected format is X.Y.Z
+    MACOSX_VERSION_MIN=10.7.0
+    AC_SUBST(MACOSX_VERSION_MIN)
 
-      # Setting these parameters makes it an error to link to macosx APIs that are
-      # newer than the given OS version and makes the linked binaries compatible
-      # even if built on a newer version of the OS.
-      # The expected format is X.Y.Z
-      MACOSX_VERSION_MIN=10.7.0
-      AC_SUBST(MACOSX_VERSION_MIN)
-
-      # The macro takes the version with no dots, ex: 1070
-      # Let the flags variables get resolved in make for easier override on make
-      # command line.
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
-      LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
-    fi
+    # The macro takes the version with no dots, ex: 1070
+    # Let the flags variables get resolved in make for easier override on make
+    # command line.
+    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
+    LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
   fi
 
   # Setup some hard coded includes
--- a/common/autoconf/generated-configure.sh	Wed Jul 09 10:41:34 2014 -0700
+++ b/common/autoconf/generated-configure.sh	Wed Jul 05 19:48:18 2017 +0200
@@ -874,6 +874,8 @@
 OUTPUT_ROOT
 CONF_NAME
 SPEC
+SDKROOT
+XCODEBUILD
 BUILD_VARIANT_RELEASE
 DEBUG_CLASSFILES
 FASTDEBUG
@@ -1040,6 +1042,7 @@
 with_tools_dir
 with_toolchain_path
 with_extra_path
+with_sdk_name
 with_conf_name
 with_builddeps_conf
 with_builddeps_server
@@ -1074,7 +1077,6 @@
 with_extra_ldflags
 enable_debug_symbols
 enable_zip_debug_info
-enable_macosx_runtime_support
 with_x
 with_cups
 with_cups_include
@@ -1085,6 +1087,7 @@
 with_alsa
 with_alsa_include
 with_alsa_lib
+with_libjpeg
 with_giflib
 with_lcms
 with_libpng
@@ -1841,9 +1844,6 @@
   --disable-debug-symbols disable generation of debug symbols [enabled]
   --disable-zip-debug-info
                           disable zipping of debug-info files [enabled]
-  --enable-macosx-runtime-support
-                          Deprecated. Option is kept for backwards
-                          compatibility and is ignored
   --disable-freetype-bundling
                           disable bundling of the freetype library with the
                           build result [enabled on Windows or when using
@@ -1872,12 +1872,13 @@
                           optimized (HotSpot build only)) [release]
   --with-devkit           use this devkit for compilers, tools and resources
   --with-sys-root         alias for --with-sysroot for backwards compatability
-  --with-sysroot          use this directory as sysroot)
+  --with-sysroot          use this directory as sysroot
   --with-tools-dir        alias for --with-toolchain-path for backwards
                           compatibility
   --with-toolchain-path   prepend these directories when searching for
                           toolchain binaries (compilers etc)
   --with-extra-path       prepend these directories to the default path
+  --with-sdk-name         use the platform SDK of the given name. [macosx]
   --with-conf-name        use this as the name of the configuration [generated
                           from important configuration options]
   --with-builddeps-conf   use this configuration file for the builddeps
@@ -1942,6 +1943,8 @@
                           headers under PATH/include)
   --with-alsa-include     specify directory for the alsa include files
   --with-alsa-lib         specify directory for the alsa library
+  --with-libjpeg          use libjpeg from build system or OpenJDK source
+                          (system, bundled) [bundled]
   --with-giflib           use giflib from build system or OpenJDK source
                           (system, bundled) [bundled]
   --with-lcms             use lcms2 from build system or OpenJDK source
@@ -4308,7 +4311,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1402614845
+DATE_WHEN_GENERATED=1403557683
 
 ###############################################################################
 #
@@ -13607,7 +13610,7 @@
       VAR_CPU_BITS=32
       VAR_CPU_ENDIAN=big
       ;;
-    sparcv9)
+    sparcv9|sparc64)
       VAR_CPU=sparcv9
       VAR_CPU_ARCH=sparc
       VAR_CPU_BITS=64
@@ -13738,7 +13741,7 @@
       VAR_CPU_BITS=32
       VAR_CPU_ENDIAN=big
       ;;
-    sparcv9)
+    sparcv9|sparc64)
       VAR_CPU=sparcv9
       VAR_CPU_ARCH=sparc
       VAR_CPU_BITS=64
@@ -14968,6 +14971,122 @@
 fi
 
 
+  if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
+    # detect if Xcode is installed by running xcodebuild -version
+    # if no Xcode installed, xcodebuild exits with 1
+    # if Xcode is installed, even if xcode-select is misconfigured, then it exits with 0
+    if /usr/bin/xcodebuild -version >/dev/null 2>&1; then
+      # We need to use xcodebuild in the toolchain dir provided by the user, this will
+      # fall back on the stub binary in /usr/bin/xcodebuild
+      # Extract the first word of "xcodebuild", so it can be a program name with args.
+set dummy xcodebuild; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_XCODEBUILD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $XCODEBUILD in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XCODEBUILD="$XCODEBUILD" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $TOOLCHAIN_PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_XCODEBUILD="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_XCODEBUILD" && ac_cv_path_XCODEBUILD="/usr/bin/xcodebuild"
+  ;;
+esac
+fi
+XCODEBUILD=$ac_cv_path_XCODEBUILD
+if test -n "$XCODEBUILD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XCODEBUILD" >&5
+$as_echo "$XCODEBUILD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    else
+      # this should result in SYSROOT being empty, unless --with-sysroot is provided
+      # when only the command line tools are installed there are no SDKs, so headers
+      # are copied into the system frameworks
+      XCODEBUILD=
+
+    fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdk name" >&5
+$as_echo_n "checking for sdk name... " >&6; }
+
+# Check whether --with-sdk-name was given.
+if test "${with_sdk_name+set}" = set; then :
+  withval=$with_sdk_name; SDKNAME=$with_sdk_name
+
+fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDKNAME" >&5
+$as_echo "$SDKNAME" >&6; }
+
+    # if toolchain path is specified then don't rely on system headers, they may not compile
+    HAVE_SYSTEM_FRAMEWORK_HEADERS=0
+    test -z "$TOOLCHAIN_PATH" && \
+      HAVE_SYSTEM_FRAMEWORK_HEADERS=`test ! -f /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h; echo $?`
+
+    if test -z "$SYSROOT"; then
+      if test -n "$XCODEBUILD"; then
+        # if we don't have system headers, use default SDK name (last resort)
+        if test -z "$SDKNAME" -a $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
+          SDKNAME=${SDKNAME:-macosx}
+        fi
+
+        if test -n "$SDKNAME"; then
+          # Call xcodebuild to determine SYSROOT
+          SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | grep '^Path: ' | sed 's/Path: //'`
+        fi
+      else
+        if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
+          as_fn_error $? "No xcodebuild tool and no system framework headers found, use --with-sysroot or --with-sdk-name to provide a path to a valid SDK" "$LINENO" 5
+        fi
+      fi
+    else
+      # warn user if --with-sdk-name was also set
+      if test -n "$with_sdk_name"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Both SYSROOT and --with-sdk-name are set, only SYSROOT will be used" >&5
+$as_echo "$as_me: WARNING: Both SYSROOT and --with-sdk-name are set, only SYSROOT will be used" >&2;}
+      fi
+    fi
+
+    if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0 -a -z "$SYSROOT"; then
+      # If no system framework headers, then SYSROOT must be set, or we won't build
+      as_fn_error $? "Unable to determine SYSROOT and no headers found in /System/Library/Frameworks. Check Xcode configuration, --with-sysroot or --with-sdk-name arguments." "$LINENO" 5
+    fi
+
+    # Perform a basic sanity test
+    if test ! -f "$SYSROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
+      if test -z "$SYSROOT"; then
+        as_fn_error $? "Unable to find required framework headers, provide a path to an SDK via --with-sysroot or --with-sdk-name and be sure Xcode is installed properly" "$LINENO" 5
+      else
+        as_fn_error $? "Invalid SDK or SYSROOT path, dependent framework headers not found" "$LINENO" 5
+      fi
+    fi
+
+    # set SDKROOT too, Xcode tools will pick it up
+    SDKROOT=$SYSROOT
+
+  fi
+
   # Prepend the extra path to the global path
 
   if test "x$EXTRA_PATH" != x; then
@@ -26596,21 +26715,28 @@
   VALID_TOOLCHAINS=${!toolchain_var_name}
 
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    # On Mac OS X, default toolchain to clang after Xcode 5
-    XCODE_VERSION_OUTPUT=`xcodebuild -version 2>&1 | $HEAD -n 1`
-    $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
-    if test $? -ne 0; then
-      as_fn_error $? "Failed to determine Xcode version." "$LINENO" 5
-    fi
-    XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
-        $SED -e 's/^Xcode \([1-9][0-9.]*\)/\1/' | \
-        $CUT -f 1 -d .`
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Xcode major version: $XCODE_MAJOR_VERSION" >&5
+    if test -n "$XCODEBUILD"; then
+      # On Mac OS X, default toolchain to clang after Xcode 5
+      XCODE_VERSION_OUTPUT=`"$XCODEBUILD" -version 2>&1 | $HEAD -n 1`
+      $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
+      if test $? -ne 0; then
+        as_fn_error $? "Failed to determine Xcode version." "$LINENO" 5
+      fi
+      XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
+          $SED -e 's/^Xcode \([1-9][0-9.]*\)/\1/' | \
+          $CUT -f 1 -d .`
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Xcode major version: $XCODE_MAJOR_VERSION" >&5
 $as_echo "$as_me: Xcode major version: $XCODE_MAJOR_VERSION" >&6;}
-    if test $XCODE_MAJOR_VERSION -ge 5; then
-        DEFAULT_TOOLCHAIN="clang"
-    else
-        DEFAULT_TOOLCHAIN="gcc"
+      if test $XCODE_MAJOR_VERSION -ge 5; then
+          DEFAULT_TOOLCHAIN="clang"
+      else
+          DEFAULT_TOOLCHAIN="gcc"
+      fi
+    else
+      # If Xcode is not installed, but the command line tools are
+      # then we can't run xcodebuild. On these systems we should
+      # default to clang
+      DEFAULT_TOOLCHAIN="clang"
     fi
   else
     # First toolchain type in the list is the default
@@ -41076,6 +41202,10 @@
             -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
             -L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
       fi
+    elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
+      # Apple only wants -isysroot <path>, but we also need -iframework<path>/System/Library/Frameworks
+      SYSROOT_CFLAGS="-isysroot \"$SYSROOT\" -iframework\"$SYSROOT/System/Library/Frameworks\""
+      SYSROOT_LDFLAGS=$SYSROOT_CFLAGS
     elif test "x$TOOLCHAIN_TYPE" = xgcc; then
       SYSROOT_CFLAGS="--sysroot=\"$SYSROOT\""
       SYSROOT_LDFLAGS="--sysroot=\"$SYSROOT\""
@@ -41089,6 +41219,14 @@
     LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $SYSROOT_LDFLAGS"
   fi
 
+  # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
+  # set this here so it doesn't have to be peppered throughout the forest
+  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    SYSROOT_CFLAGS="$SYSROOT_CFLAGS -F\"$SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks\""
+    SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -F\"$SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks\""
+  fi
+
+
 
 
 
@@ -42135,23 +42273,18 @@
 
   # Additional macosx handling
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    if test "x$TOOLCHAIN_TYPE" = xgcc; then
-      # FIXME: This needs to be exported in spec.gmk due to closed legacy code.
-      # FIXME: clean this up, and/or move it elsewhere.
-
-      # Setting these parameters makes it an error to link to macosx APIs that are
-      # newer than the given OS version and makes the linked binaries compatible
-      # even if built on a newer version of the OS.
-      # The expected format is X.Y.Z
-      MACOSX_VERSION_MIN=10.7.0
-
-
-      # The macro takes the version with no dots, ex: 1070
-      # Let the flags variables get resolved in make for easier override on make
-      # command line.
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
-      LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
-    fi
+    # Setting these parameters makes it an error to link to macosx APIs that are
+    # newer than the given OS version and makes the linked binaries compatible
+    # even if built on a newer version of the OS.
+    # The expected format is X.Y.Z
+    MACOSX_VERSION_MIN=10.7.0
+
+
+    # The macro takes the version with no dots, ex: 1070
+    # Let the flags variables get resolved in make for easier override on make
+    # command line.
+    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
+    LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
   fi
 
   # Setup some hard coded includes
@@ -42654,8 +42787,6 @@
     ALSA_NOT_NEEDED=yes
     PULSE_NOT_NEEDED=yes
     X11_NOT_NEEDED=yes
-    # If the java runtime framework is disabled, then we need X11.
-    # This will be adjusted below.
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: alsa pulse x11" >&5
 $as_echo "alsa pulse x11" >&6; }
   fi
@@ -42676,33 +42807,6 @@
     X11_NOT_NEEDED=yes
   fi
 
-  ###############################################################################
-  #
-  # Check for MacOSX support for OpenJDK.
-  #
-
-
-  # Check whether --enable-macosx-runtime-support was given.
-if test "${enable_macosx_runtime_support+set}" = set; then :
-  enableval=$enable_macosx_runtime_support;
-fi
-
-  if test "x$enable_macosx_runtime_support" != x; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --enable-macosx-runtime-support is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --enable-macosx-runtime-support is deprecated and will be ignored." >&2;}
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mac OS X Java Framework" >&5
-$as_echo_n "checking for Mac OS X Java Framework... " >&6; }
-  if test -f /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Headers/JavaRuntimeSupport.h; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: /System/Library/Frameworks/JavaVM.framework" >&5
-$as_echo "/System/Library/Frameworks/JavaVM.framework" >&6; }
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-  fi
-
 
 
   ###############################################################################
@@ -47573,10 +47677,43 @@
   # Check for the jpeg library
   #
 
-  USE_EXTERNAL_LIBJPEG=true
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ljpeg" >&5
-$as_echo_n "checking for main in -ljpeg... " >&6; }
-if ${ac_cv_lib_jpeg_main+:} false; then :
+
+# Check whether --with-libjpeg was given.
+if test "${with_libjpeg+set}" = set; then :
+  withval=$with_libjpeg;
+fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which libjpeg to use" >&5
+$as_echo_n "checking for which libjpeg to use... " >&6; }
+
+  # default is bundled
+  DEFAULT_LIBJPEG=bundled
+
+  #
+  # if user didn't specify, use DEFAULT_LIBJPEG
+  #
+  if test "x${with_libjpeg}" = "x"; then
+    with_libjpeg=${DEFAULT_LIBJPEG}
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_libjpeg}" >&5
+$as_echo "${with_libjpeg}" >&6; }
+
+  if test "x${with_libjpeg}" = "xbundled"; then
+    USE_EXTERNAL_LIBJPEG=false
+  elif test "x${with_libjpeg}" = "xsystem"; then
+    ac_fn_cxx_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
+if test "x$ac_cv_header_jpeglib_h" = xyes; then :
+
+else
+   as_fn_error $? "--with-libjpeg=system specified, but jpeglib.h not found!" "$LINENO" 5
+fi
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_CreateDecompress in -ljpeg" >&5
+$as_echo_n "checking for jpeg_CreateDecompress in -ljpeg... " >&6; }
+if ${ac_cv_lib_jpeg_jpeg_CreateDecompress+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -47584,27 +47721,33 @@
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
-int
-main ()
-{
-return main ();
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char jpeg_CreateDecompress ();
+int
+main ()
+{
+return jpeg_CreateDecompress ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_cxx_try_link "$LINENO"; then :
-  ac_cv_lib_jpeg_main=yes
-else
-  ac_cv_lib_jpeg_main=no
+  ac_cv_lib_jpeg_jpeg_CreateDecompress=yes
+else
+  ac_cv_lib_jpeg_jpeg_CreateDecompress=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_main" >&5
-$as_echo "$ac_cv_lib_jpeg_main" >&6; }
-if test "x$ac_cv_lib_jpeg_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_CreateDecompress" >&5
+$as_echo "$ac_cv_lib_jpeg_jpeg_CreateDecompress" >&6; }
+if test "x$ac_cv_lib_jpeg_jpeg_CreateDecompress" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBJPEG 1
 _ACEOF
@@ -47612,11 +47755,14 @@
   LIBS="-ljpeg $LIBS"
 
 else
-   USE_EXTERNAL_LIBJPEG=false
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Will use jpeg decoder bundled with the OpenJDK source" >&5
-$as_echo "$as_me: Will use jpeg decoder bundled with the OpenJDK source" >&6;}
-
-fi
+   as_fn_error $? "--with-libjpeg=system specified, but no libjpeg found" "$LINENO" 5
+fi
+
+
+    USE_EXTERNAL_LIBJPEG=true
+  else
+    as_fn_error $? "Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'" "$LINENO" 5
+  fi
 
 
 
--- a/common/autoconf/libraries.m4	Wed Jul 09 10:41:34 2014 -0700
+++ b/common/autoconf/libraries.m4	Wed Jul 05 19:48:18 2017 +0200
@@ -65,8 +65,6 @@
     ALSA_NOT_NEEDED=yes
     PULSE_NOT_NEEDED=yes
     X11_NOT_NEEDED=yes
-    # If the java runtime framework is disabled, then we need X11.
-    # This will be adjusted below.
     AC_MSG_RESULT([alsa pulse x11])
   fi
 
@@ -83,20 +81,6 @@
   if test "x$SUPPORT_HEADFUL" = xno; then
     X11_NOT_NEEDED=yes
   fi
-
-  ###############################################################################
-  #
-  # Check for MacOSX support for OpenJDK.
-  #
-
-  BASIC_DEPRECATED_ARG_ENABLE(macosx-runtime-support, macosx_runtime_support)
-
-  AC_MSG_CHECKING([for Mac OS X Java Framework])
-  if test -f /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Headers/JavaRuntimeSupport.h; then
-    AC_MSG_RESULT([/System/Library/Frameworks/JavaVM.framework])
-  else
-    AC_MSG_RESULT([no])
-  fi
 ])
 
 AC_DEFUN_ONCE([LIB_SETUP_X11],
@@ -620,11 +604,36 @@
   # Check for the jpeg library
   #
 
-  USE_EXTERNAL_LIBJPEG=true
-  AC_CHECK_LIB(jpeg, main, [],
-      [ USE_EXTERNAL_LIBJPEG=false
-      AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source])
-  ])
+  AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg],
+      [use libjpeg from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
+
+  AC_MSG_CHECKING([for which libjpeg to use])
+
+  # default is bundled
+  DEFAULT_LIBJPEG=bundled
+
+  #
+  # if user didn't specify, use DEFAULT_LIBJPEG
+  #
+  if test "x${with_libjpeg}" = "x"; then
+    with_libjpeg=${DEFAULT_LIBJPEG}
+  fi
+
+  AC_MSG_RESULT(${with_libjpeg})
+
+  if test "x${with_libjpeg}" = "xbundled"; then
+    USE_EXTERNAL_LIBJPEG=false
+  elif test "x${with_libjpeg}" = "xsystem"; then
+    AC_CHECK_HEADER(jpeglib.h, [],
+        [ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
+    AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
+        [ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
+
+    USE_EXTERNAL_LIBJPEG=true
+  else
+    AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
+  fi
+
   AC_SUBST(USE_EXTERNAL_LIBJPEG)
 
   ###############################################################################
--- a/common/autoconf/platform.m4	Wed Jul 09 10:41:34 2014 -0700
+++ b/common/autoconf/platform.m4	Wed Jul 05 19:48:18 2017 +0200
@@ -84,7 +84,7 @@
       VAR_CPU_BITS=32
       VAR_CPU_ENDIAN=big
       ;;
-    sparcv9)
+    sparcv9|sparc64)
       VAR_CPU=sparcv9
       VAR_CPU_ARCH=sparc
       VAR_CPU_BITS=64
--- a/common/autoconf/spec.gmk.in	Wed Jul 09 10:41:34 2014 -0700
+++ b/common/autoconf/spec.gmk.in	Wed Jul 05 19:48:18 2017 +0200
@@ -347,6 +347,9 @@
 # The linker can be gcc or ld on posix systems, or link.exe on windows systems.
 LD:=@FIXPATH@ @LD@
 
+# Xcode SDK path
+SDKROOT:=@SDKROOT@
+
 # The linker on older SuSE distros (e.g. on SLES 10) complains with:
 # "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
 # if feeded with a version script which contains named tags.
@@ -544,7 +547,7 @@
 XATTR:=@XATTR@
 JT_HOME:=@JT_HOME@
 JTREGEXE:=@JTREGEXE@
-
+XCODEBUILD=@XCODEBUILD@
 FIXPATH:=@FIXPATH@
 
 # Where the build output is stored for your convenience.
--- a/common/autoconf/toolchain.m4	Wed Jul 09 10:41:34 2014 -0700
+++ b/common/autoconf/toolchain.m4	Wed Jul 05 19:48:18 2017 +0200
@@ -98,20 +98,27 @@
   VALID_TOOLCHAINS=${!toolchain_var_name}
 
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    # On Mac OS X, default toolchain to clang after Xcode 5
-    XCODE_VERSION_OUTPUT=`xcodebuild -version 2>&1 | $HEAD -n 1`
-    $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
-    if test $? -ne 0; then
-      AC_MSG_ERROR([Failed to determine Xcode version.])
-    fi
-    XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
-        $SED -e 's/^Xcode \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/' | \
-        $CUT -f 1 -d .`
-    AC_MSG_NOTICE([Xcode major version: $XCODE_MAJOR_VERSION])
-    if test $XCODE_MAJOR_VERSION -ge 5; then
-        DEFAULT_TOOLCHAIN="clang"
+    if test -n "$XCODEBUILD"; then
+      # On Mac OS X, default toolchain to clang after Xcode 5
+      XCODE_VERSION_OUTPUT=`"$XCODEBUILD" -version 2>&1 | $HEAD -n 1`
+      $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
+      if test $? -ne 0; then
+        AC_MSG_ERROR([Failed to determine Xcode version.])
+      fi
+      XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
+          $SED -e 's/^Xcode \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/' | \
+          $CUT -f 1 -d .`
+      AC_MSG_NOTICE([Xcode major version: $XCODE_MAJOR_VERSION])
+      if test $XCODE_MAJOR_VERSION -ge 5; then
+          DEFAULT_TOOLCHAIN="clang"
+      else
+          DEFAULT_TOOLCHAIN="gcc"
+      fi
     else
-        DEFAULT_TOOLCHAIN="gcc"
+      # If Xcode is not installed, but the command line tools are
+      # then we can't run xcodebuild. On these systems we should
+      # default to clang
+      DEFAULT_TOOLCHAIN="clang"
     fi
   else
     # First toolchain type in the list is the default
--- a/corba/.hgtags	Wed Jul 09 10:41:34 2014 -0700
+++ b/corba/.hgtags	Wed Jul 05 19:48:18 2017 +0200
@@ -263,3 +263,4 @@
 77565aaaa2bb814e94817e92d680168052a25395 jdk9-b18
 eecc1b6adc7e193d00a0641eb0963add5a4c06e8 jdk9-b19
 87f36eecb1665012d01c5cf102494e591c943ea6 jdk9-b20
+3615a4e7f0542ca7552ad6454b742c73ee211d8e jdk9-b21
--- a/corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java	Wed Jul 09 10:41:34 2014 -0700
+++ b/corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java	Wed Jul 05 19:48:18 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,8 @@
 import java.io.OutputStream;
 import java.io.ObjectOutputStream;
 import java.io.ObjectOutput;
-import java.util.Hashtable;
+import java.util.Map;
+import java.util.HashMap;
 
 import org.omg.CORBA.INTERNAL;
 
@@ -49,7 +50,7 @@
      */
     private class HookPutFields extends ObjectOutputStream.PutField
     {
-        private Hashtable fields = new Hashtable();
+        private Map<String,Object> fields = new HashMap<>();
 
         /**
          * Put the value of the named boolean field into the persistent field.
@@ -140,7 +141,6 @@
     public OutputStreamHook()
         throws java.io.IOException {
         super();
-
     }
 
     public void defaultWriteObject() throws IOException {
--- a/get_source.sh	Wed Jul 09 10:41:34 2014 -0700
+++ b/get_source.sh	Wed Jul 05 19:48:18 2017 +0200
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 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
@@ -25,9 +25,48 @@
 # questions.
 #
 
-# Get clones of all nested repositories
-sh ./common/bin/hgforest.sh clone "$@" || exit 1
+# Version check
+
+# required
+reqdmajor=1
+reqdminor=5
+reqdrev=0
+
+# requested
+rqstmajor=2
+rqstminor=6
+rqstrev=3
+
+# installed
+hgwhere="`which hg 2> /dev/null | grep -v '^no hg in '`"
+if [ "x$hgwhere" = "x" ]; then
+  echo "ERROR: Could not locate Mercurial command" >&2
+  exit 126
+fi
+
+hgversion="`hg --version 2> /dev/null | sed -n -e 's@^Mercurial Distributed SCM (version \(.*\))\$@\1@p'`"
+if [ "x${hgversion}" = "x" ] ; then
+  echo "ERROR: Could not determine Mercurial version" >&2
+  exit 126
+fi
+
+hgmajor="`echo $hgversion | cut -f 1 -d .`"
+hgminor="`echo $hgversion | cut -f 2 -d .`"
+hgrev="`echo $hgversion.0 | cut -f 3 -d .`" # rev is omitted for minor and major releases
+
+# Require
+if [ $hgmajor -lt $reqdmajor -o \( $hgmajor -eq $reqdmajor -a $hgminor -lt $reqdminor \) -o \( $hgmajor -eq $reqdmajor -a $hgminor -eq $reqdminor -a $hgrev -lt $reqdrev \) ] ; then
+  echo "ERROR: Mercurial version $reqdmajor.$reqdminor.$reqdrev or later is required. $hgwhere is version $hgversion" >&2
+  exit 126
+fi
+
+# Request
+if [ $hgmajor -lt $rqstmajor -o \( $hgmajor -eq $rqstmajor -a $hgminor -lt $rqstminor \) -o \( $hgmajor -eq $rqstmajor -a $hgminor -eq $rqstminor -a $hgrev -lt $rqstrev \) ] ; then
+  echo "WARNING: Mercurial version $rqstmajor.$rqstminor.$rqstrev or later is recommended. $hgwhere is version $hgversion" >&2
+fi
+
+# Get clones of all absent nested repositories (harmless if already exist)
+sh ./common/bin/hgforest.sh clone "$@" || exit $?
 
 # Update all existing repositories to the latest sources
 sh ./common/bin/hgforest.sh pull -u
-
--- a/hotspot/.hgtags	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/.hgtags	Wed Jul 05 19:48:18 2017 +0200
@@ -423,3 +423,4 @@
 871fd128548480095e0dc3fc34c422666baeec75 jdk9-b18
 d4cffb3ae6213c66c7522ebffe0349360a45f0ef jdk9-b19
 c1af79d122ec9f715fa29312b5e91763f3a4dfc4 jdk9-b20
+17b4a5e831b398738feedb0afe75245744510153 jdk9-b21
--- a/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/agent/src/os/bsd/Makefile	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/agent/src/os/linux/libproc.h	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/agent/src/os/linux/ps_proc.c	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/make/bsd/makefiles/saproc.make	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/make/bsd/makefiles/vm.make	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/make/linux/makefiles/vm.make	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/make/windows/create.bat	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/make/windows/makefiles/compile.make	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/make/windows/makefiles/rules.make	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/make/windows/makefiles/sa.make	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/make/windows/makefiles/sanity.make	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/make/windows/makefiles/vm.make	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/make/windows/projectfiles/common/Makefile	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.hpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.hpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.hpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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 05 19:48:18 2017 +0200
@@ -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 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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 05 19:48:18 2017 +0200
@@ -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 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/memory/metaspace.hpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/memory/universe.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/oops/method.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/prims/jni.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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	Wed Jul 09 10:41:34 2014 -0700
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp	Wed Jul 05 19:48:18 2017 +0200
@@ -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);