changeset 48544:544780faedb0 mvt

Merge
author dsimms
date Thu, 11 Jan 2018 10:45:44 +0100
parents 00be52e4338c c10b8e775610
children 45ac8bb4f6f5
files make/Images.gmk make/autoconf/generated-configure.sh make/conf/jib-profiles.js make/langtools/intellij/runConfigurations/javah.xml make/langtools/test/bootstrap/javah.sh make/langtools/test/lib/javah.sh src/hotspot/cpu/x86/x86_64.ad src/hotspot/share/ci/ciField.cpp src/hotspot/share/classfile/classFileParser.cpp src/hotspot/share/classfile/classLoaderData.cpp src/hotspot/share/classfile/classLoaderData.hpp src/hotspot/share/classfile/vmSymbols.hpp src/hotspot/share/compiler/compileBroker.cpp src/hotspot/share/jvmci/jvmciCodeInstaller.cpp src/hotspot/share/jvmci/jvmciCompilerToVM.cpp src/hotspot/share/opto/compile.cpp src/hotspot/share/opto/compile.hpp src/hotspot/share/opto/library_call.cpp src/hotspot/share/runtime/arguments.cpp src/hotspot/share/runtime/thread.cpp src/hotspot/share/runtime/thread.hpp src/java.base/share/classes/java/util/ArraysSupport.java src/java.base/share/classes/module-info.java src/java.base/share/native/include/classfile_constants.h src/java.base/share/native/include/classfile_constants.h.template src/java.base/share/native/libjava/System.c src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CooperativePhaseTest.java test/hotspot/jtreg/ProblemList.txt test/jdk/java/net/httpclient/RequestProcessorExceptions.java test/langtools/tools/javac/T6356530/SerializableAbstractClassWithNonAbstractMethodsTest.java test/langtools/tools/javac/T6356530/SerializableAbstractClassWithNonAbstractMethodsTest.out test/langtools/tools/javac/diags/examples.not-yet.txt
diffstat 792 files changed, 9612 insertions(+), 5016 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Wed Dec 20 11:57:20 2017 +0100
+++ b/.hgignore	Thu Jan 11 10:45:44 2018 +0100
@@ -11,3 +11,5 @@
 test/nashorn/script/external
 test/nashorn/lib
 NashornProfile.txt
+.*/JTreport/.*
+.*/JTwork/.*
--- a/.hgtags	Wed Dec 20 11:57:20 2017 +0100
+++ b/.hgtags	Thu Jan 11 10:45:44 2018 +0100
@@ -462,3 +462,5 @@
 d8c634b016c628622c9abbdc6bf50509e5dedbec jdk-10+35
 0ee20aad71c4f33c426372b4c8bcc1235ce2ec08 jdk-11+0
 959f2f7cbaa6d2ee45d50029744efb219721576c jdk-10+36
+4f830b447edf04fb4a52151a5ad44d9bb60723cd jdk-10+37
+e569e83139fdfbecfeb3cd9014d560917787f158 jdk-10+38
--- a/make/Images.gmk	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/Images.gmk	Thu Jan 11 10:45:44 2018 +0100
@@ -215,7 +215,6 @@
       jarsigner.1 \
       javac.1 \
       javadoc.1 \
-      javah.1 \
       javap.1 \
       jconsole.1 \
       jcmd.1 \
--- a/make/Main.gmk	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/Main.gmk	Thu Jan 11 10:45:44 2018 +0100
@@ -637,7 +637,7 @@
   # Declare dependencies between hotspot-<variant>* targets
   $(foreach v, $(JVM_VARIANTS), \
       $(eval hotspot-$v: hotspot-$v-gensrc hotspot-$v-libs) \
-      $(eval hotspot-$v-libs: hotspot-$v-gensrc) \
+      $(eval hotspot-$v-libs: hotspot-$v-gensrc java.base-copy) \
   )
 
   hotspot-ide-project: hotspot exploded-image
@@ -691,8 +691,9 @@
   jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
 
   # The swing beans need to have java base properly generated to avoid errors
-  # in javadoc.
-  java.desktop-gensrc-src: java.base-gensrc
+  # in javadoc. The X11 wrappers need the java.base include files to have been
+  # copied and processed.
+  java.desktop-gensrc-src: java.base-gensrc java.base-copy
 
   # The annotation processing for jdk.internal.vm.ci and jdk.internal.vm.compiler
   # needs classes from the current JDK.
--- a/make/RunTestsPrebuiltSpec.gmk	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/RunTestsPrebuiltSpec.gmk	Thu Jan 11 10:45:44 2018 +0100
@@ -110,7 +110,6 @@
 # Java executable definitions
 JAVA_CMD := $(BOOT_JDK)/bin/java
 JAVAC_CMD := $(BOOT_JDK)/bin/javac
-JAVAH_CMD := $(BOOT_JDK)/bin/javah
 JAR_CMD := $(BOOT_JDK)/bin/jar
 JLINK_CMD := $(JDK_OUTPUTDIR)/bin/jlink
 JMOD_CMD := $(JDK_OUTPUTDIR)/bin/jmod
@@ -120,7 +119,6 @@
 JAVA_SMALL := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
 JAVA_JAVAC := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
 JAVAC := $(FIXPATH) $(JAVAC_CMD)
-JAVAH := $(FIXPATH) $(JAVAH_CMD)
 JAR := $(FIXPATH) $(JAR_CMD)
 JLINK := $(FIXPATH) $(JLINK_CMD)
 JMOD := $(FIXPATH) $(JMOD_CMD)
--- a/make/autoconf/boot-jdk.m4	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/autoconf/boot-jdk.m4	Thu Jan 11 10:45:44 2018 +0100
@@ -295,7 +295,6 @@
   # Setup tools from the Boot JDK.
   BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java)
   BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac)
-  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAH, javah)
   BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVADOC, javadoc)
   BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar)
   BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JARSIGNER, jarsigner)
--- a/make/autoconf/bootcycle-spec.gmk.in	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/autoconf/bootcycle-spec.gmk.in	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, 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
@@ -52,7 +52,6 @@
 
 JAVA_CMD:=$(BOOT_JDK)/bin/java
 JAVAC_CMD:=$(BOOT_JDK)/bin/javac
-JAVAH_CMD:=$(BOOT_JDK)/bin/javah
 JAR_CMD:=$(BOOT_JDK)/bin/jar
 JARSIGNER_CMD:=$(BOOT_JDK)/bin/jarsigner
 SJAVAC_SERVER_JAVA_CMD:=$(JAVA_CMD)
--- a/make/autoconf/buildjdk-spec.gmk.in	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/autoconf/buildjdk-spec.gmk.in	Thu Jan 11 10:45:44 2018 +0100
@@ -55,6 +55,7 @@
 OPENJDK_TARGET_CPU_BITS := @OPENJDK_BUILD_CPU_BITS@
 OPENJDK_TARGET_CPU_ENDIAN := @OPENJDK_BUILD_CPU_ENDIAN@
 OPENJDK_TARGET_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
+OPENJDK_TARGET_OS_INCLUDE_SUBDIR := @OPENJDK_BUILD_OS_INCLUDE_SUBDIR@
 
 HOTSPOT_TARGET_OS := @HOTSPOT_BUILD_OS@
 HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_BUILD_OS_TYPE@
--- a/make/autoconf/flags.m4	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/autoconf/flags.m4	Thu Jan 11 10:45:44 2018 +0100
@@ -1162,9 +1162,7 @@
   # Setup some hard coded includes
   $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
       -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
-      -I${TOPDIR}/src/java.base/share/native/include \
-      -I${TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \
-      -I${TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \
+      -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
       -I${TOPDIR}/src/java.base/share/native/libjava \
       -I${TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/libjava \
       -I${TOPDIR}/src/hotspot/share/include \
--- a/make/autoconf/generated-configure.sh	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/autoconf/generated-configure.sh	Thu Jan 11 10:45:44 2018 +0100
@@ -881,12 +881,13 @@
 JARSIGNER
 JAR
 JAVADOC
-JAVAH
 JAVAC
 JAVA
 BOOT_JDK
 JAVA_CHECK
 JAVAC_CHECK
+VERSION_CLASSFILE_MINOR
+VERSION_CLASSFILE_MAJOR
 VENDOR_VERSION_STRING
 VERSION_DATE
 VERSION_IS_GA
@@ -901,10 +902,10 @@
 VERSION_UPDATE
 VERSION_INTERIM
 VERSION_FEATURE
+COMPANY_NAME
 MACOSX_BUNDLE_ID_BASE
 MACOSX_BUNDLE_NAME_BASE
 HOTSPOT_VM_DISTRO
-COMPANY_NAME
 JDK_RC_PLATFORM_NAME
 PRODUCT_SUFFIX
 PRODUCT_NAME
@@ -968,6 +969,7 @@
 USERNAME
 TOPDIR
 PATH_SEP
+OPENJDK_BUILD_OS_INCLUDE_SUBDIR
 HOTSPOT_BUILD_CPU_DEFINE
 HOTSPOT_BUILD_CPU_ARCH
 HOTSPOT_BUILD_CPU
@@ -978,6 +980,7 @@
 OPENJDK_BUILD_CPU_ISADIR
 OPENJDK_BUILD_CPU_LEGACY_LIB
 OPENJDK_BUILD_CPU_LEGACY
+OPENJDK_TARGET_OS_INCLUDE_SUBDIR
 HOTSPOT_TARGET_CPU_DEFINE
 HOTSPOT_TARGET_CPU_ARCH
 HOTSPOT_TARGET_CPU
@@ -1147,6 +1150,7 @@
 with_version_major
 with_version_minor
 with_version_security
+with_vendor_name
 with_version_string
 with_version_pre
 with_version_opt
@@ -1299,7 +1303,6 @@
 PKG_CONFIG
 JAVA
 JAVAC
-JAVAH
 JAVADOC
 JAR
 JARSIGNER
@@ -2083,6 +2086,7 @@
                           compatibility and is ignored
   --with-version-security Deprecated. Option is kept for backwards
                           compatibility and is ignored
+  --with-vendor-name      Set vendor name [not specified]
   --with-version-string   Set version string [calculated]
   --with-version-pre      Set the base part of the version 'PRE' field
                           (pre-release identifier) ['internal']
@@ -2269,7 +2273,6 @@
   PKG_CONFIG  path to pkg-config utility
   JAVA        Override default value for JAVA
   JAVAC       Override default value for JAVAC
-  JAVAH       Override default value for JAVAH
   JAVADOC     Override default value for JAVADOC
   JAR         Override default value for JAR
   JARSIGNER   Override default value for JARSIGNER
@@ -5185,7 +5188,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1513206608
+DATE_WHEN_GENERATED=1515660326
 
 ###############################################################################
 #
@@ -16316,6 +16319,14 @@
   fi
 
 
+  # For historical reasons, the OS include directories have odd names.
+  OPENJDK_TARGET_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
+  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+    OPENJDK_TARGET_OS_INCLUDE_SUBDIR="win32"
+  elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+    OPENJDK_TARGET_OS_INCLUDE_SUBDIR="darwin"
+  fi
+
 
 
   # Also store the legacy naming of the cpu.
@@ -16467,6 +16478,14 @@
   fi
 
 
+  # For historical reasons, the OS include directories have odd names.
+  OPENJDK_BUILD_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
+  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+    OPENJDK_BUILD_OS_INCLUDE_SUBDIR="win32"
+  elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+    OPENJDK_BUILD_OS_INCLUDE_SUBDIR="darwin"
+  fi
+
 
 
 
@@ -25055,6 +25074,21 @@
 
 
 
+  # The vendor name, if any
+
+# Check whether --with-vendor-name was given.
+if test "${with_vendor_name+set}" = set; then :
+  withval=$with_vendor_name;
+fi
+
+  if test "x$with_vendor_name" = xyes; then
+    as_fn_error $? "--with-vendor-name must have a value" "$LINENO" 5
+  elif  ! [[ $with_vendor_name =~ ^[[:print:]]*$ ]] ; then
+    as_fn_error $? "--with--vendor-name contains non-printing characters: $with_vendor_name" "$LINENO" 5
+  else
+    COMPANY_NAME="$with_vendor_name"
+  fi
+
 
   # Override version from arguments
 
@@ -25457,6 +25491,10 @@
     VENDOR_VERSION_STRING="$with_vendor_version_string"
   fi
 
+  # We could define --with flags for these, if really needed
+  VERSION_CLASSFILE_MAJOR="$DEFAULT_VERSION_CLASSFILE_MAJOR"
+  VERSION_CLASSFILE_MINOR="$DEFAULT_VERSION_CLASSFILE_MINOR"
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version string" >&5
 $as_echo_n "checking for version string... " >&6; }
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VERSION_STRING" >&5
@@ -25478,6 +25516,9 @@
 
 
 
+
+
+
 ###############################################################################
 #
 # Setup BootJDK, used to bootstrap the build.
@@ -30908,144 +30949,6 @@
   # Publish this variable in the help.
 
 
-  if [ -z "${JAVAH+x}" ]; then
-    # The variable is not set by user, try to locate tool using the code snippet
-
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javah in Boot JDK" >&5
-$as_echo_n "checking for javah in Boot JDK... " >&6; }
-      JAVAH=$BOOT_JDK/bin/javah
-      if test ! -x $JAVAH; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-$as_echo "not found" >&6; }
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitly setting --with-boot-jdk" >&5
-$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitly setting --with-boot-jdk" >&6;}
-        as_fn_error $? "Could not find javah in the Boot JDK" "$LINENO" 5
-      fi
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
-$as_echo "ok" >&6; }
-
-
-  else
-    # The variable is set, but is it from the command line or the environment?
-
-    # Try to remove the string !JAVAH! from our list.
-    try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!JAVAH!/}
-    if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
-      # If it failed, the variable was not from the command line. Ignore it,
-      # but warn the user (except for BASH, which is always set by the calling BASH).
-      if test "xJAVAH" != xBASH; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of JAVAH from the environment. Use command line variables instead." >&5
-$as_echo "$as_me: WARNING: Ignoring value of JAVAH from the environment. Use command line variables instead." >&2;}
-      fi
-      # Try to locate tool using the code snippet
-
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javah in Boot JDK" >&5
-$as_echo_n "checking for javah in Boot JDK... " >&6; }
-      JAVAH=$BOOT_JDK/bin/javah
-      if test ! -x $JAVAH; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-$as_echo "not found" >&6; }
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitly setting --with-boot-jdk" >&5
-$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitly setting --with-boot-jdk" >&6;}
-        as_fn_error $? "Could not find javah in the Boot JDK" "$LINENO" 5
-      fi
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
-$as_echo "ok" >&6; }
-
-
-    else
-      # If it succeeded, then it was overridden by the user. We will use it
-      # for the tool.
-
-      # First remove it from the list of overridden variables, so we can test
-      # for unknown variables in the end.
-      CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
-
-      # Check if we try to supply an empty value
-      if test "x$JAVAH" = x; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool JAVAH= (no value)" >&5
-$as_echo "$as_me: Setting user supplied tool JAVAH= (no value)" >&6;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JAVAH" >&5
-$as_echo_n "checking for JAVAH... " >&6; }
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
-$as_echo "disabled" >&6; }
-      else
-        # Check if the provided tool contains a complete path.
-        tool_specified="$JAVAH"
-        tool_basename="${tool_specified##*/}"
-        if test "x$tool_basename" = "x$tool_specified"; then
-          # A command without a complete path is provided, search $PATH.
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool JAVAH=$tool_basename" >&5
-$as_echo "$as_me: Will search for user supplied tool JAVAH=$tool_basename" >&6;}
-          # Extract the first word of "$tool_basename", so it can be a program name with args.
-set dummy $tool_basename; 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_JAVAH+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $JAVAH in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_JAVAH="$JAVAH" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $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_JAVAH="$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
-
-  ;;
-esac
-fi
-JAVAH=$ac_cv_path_JAVAH
-if test -n "$JAVAH"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAH" >&5
-$as_echo "$JAVAH" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-          if test "x$JAVAH" = x; then
-            as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
-          fi
-        else
-          # Otherwise we believe it is a complete path. Use it as it is.
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool JAVAH=$tool_specified" >&5
-$as_echo "$as_me: Will use user supplied tool JAVAH=$tool_specified" >&6;}
-          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JAVAH" >&5
-$as_echo_n "checking for JAVAH... " >&6; }
-          if test ! -x "$tool_specified"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-$as_echo "not found" >&6; }
-            as_fn_error $? "User supplied tool JAVAH=$tool_specified does not exist or is not executable" "$LINENO" 5
-          fi
-          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
-$as_echo "$tool_specified" >&6; }
-        fi
-      fi
-    fi
-
-  fi
-
-
-
-  # Use user overridden value if available, otherwise locate tool in the Boot JDK.
-
-  # Publish this variable in the help.
-
-
   if [ -z "${JAVADOC+x}" ]; then
     # The variable is not set by user, try to locate tool using the code snippet
 
@@ -52888,9 +52791,7 @@
   # Setup some hard coded includes
   COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
       -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
-      -I${TOPDIR}/src/java.base/share/native/include \
-      -I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
-      -I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include \
+      -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
       -I${TOPDIR}/src/java.base/share/native/libjava \
       -I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava \
       -I${TOPDIR}/src/hotspot/share/include \
@@ -53771,9 +53672,7 @@
   # Setup some hard coded includes
   OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK \
       -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
-      -I${TOPDIR}/src/java.base/share/native/include \
-      -I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS/native/include \
-      -I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/include \
+      -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
       -I${TOPDIR}/src/java.base/share/native/libjava \
       -I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/libjava \
       -I${TOPDIR}/src/hotspot/share/include \
--- a/make/autoconf/jdk-version.m4	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/autoconf/jdk-version.m4	Thu Jan 11 10:45:44 2018 +0100
@@ -74,11 +74,22 @@
   AC_SUBST(PRODUCT_NAME)
   AC_SUBST(PRODUCT_SUFFIX)
   AC_SUBST(JDK_RC_PLATFORM_NAME)
-  AC_SUBST(COMPANY_NAME)
   AC_SUBST(HOTSPOT_VM_DISTRO)
   AC_SUBST(MACOSX_BUNDLE_NAME_BASE)
   AC_SUBST(MACOSX_BUNDLE_ID_BASE)
 
+  # The vendor name, if any
+  AC_ARG_WITH(vendor-name, [AS_HELP_STRING([--with-vendor-name],
+      [Set vendor name @<:@not specified@:>@])])
+  if test "x$with_vendor_name" = xyes; then
+    AC_MSG_ERROR([--with-vendor-name must have a value])
+  elif [ ! [[ $with_vendor_name =~ ^[[:print:]]*$ ]] ]; then
+    AC_MSG_ERROR([--with--vendor-name contains non-printing characters: $with_vendor_name])
+  else
+    COMPANY_NAME="$with_vendor_name"
+  fi
+  AC_SUBST(COMPANY_NAME)
+
   # Override version from arguments
 
   # If --with-version-string is set, process it first. It is possible to
@@ -331,6 +342,10 @@
     VENDOR_VERSION_STRING="$with_vendor_version_string"
   fi
 
+  # We could define --with flags for these, if really needed
+  VERSION_CLASSFILE_MAJOR="$DEFAULT_VERSION_CLASSFILE_MAJOR"
+  VERSION_CLASSFILE_MINOR="$DEFAULT_VERSION_CLASSFILE_MINOR"
+
   AC_MSG_CHECKING([for version string])
   AC_MSG_RESULT([$VERSION_STRING])
 
@@ -348,4 +363,7 @@
   AC_SUBST(VERSION_IS_GA)
   AC_SUBST(VERSION_DATE)
   AC_SUBST(VENDOR_VERSION_STRING)
+  AC_SUBST(VERSION_CLASSFILE_MAJOR)
+  AC_SUBST(VERSION_CLASSFILE_MINOR)
+
 ])
--- a/make/autoconf/platform.m4	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/autoconf/platform.m4	Thu Jan 11 10:45:44 2018 +0100
@@ -478,6 +478,14 @@
   fi
   AC_SUBST(HOTSPOT_$1_CPU_DEFINE)
 
+  # For historical reasons, the OS include directories have odd names.
+  OPENJDK_$1_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
+  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+    OPENJDK_$1_OS_INCLUDE_SUBDIR="win32"
+  elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+    OPENJDK_$1_OS_INCLUDE_SUBDIR="darwin"
+  fi
+  AC_SUBST(OPENJDK_$1_OS_INCLUDE_SUBDIR)
 ])
 
 AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
--- a/make/autoconf/spec.gmk.in	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/autoconf/spec.gmk.in	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2018, 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
@@ -78,6 +78,7 @@
 OPENJDK_TARGET_CPU_LEGACY:=@OPENJDK_TARGET_CPU_LEGACY@
 OPENJDK_TARGET_CPU_LEGACY_LIB:=@OPENJDK_TARGET_CPU_LEGACY_LIB@
 OPENJDK_TARGET_CPU_OSARCH:=@OPENJDK_TARGET_CPU_OSARCH@
+OPENJDK_TARGET_OS_INCLUDE_SUBIDR:=@OPENJDK_TARGET_OS_INCLUDE_SUBDIR@
 
 HOTSPOT_TARGET_OS := @HOTSPOT_TARGET_OS@
 HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_TARGET_OS_TYPE@
@@ -100,6 +101,8 @@
 OPENJDK_BUILD_CPU_BITS:=@OPENJDK_BUILD_CPU_BITS@
 OPENJDK_BUILD_CPU_ENDIAN:=@OPENJDK_BUILD_CPU_ENDIAN@
 
+OPENJDK_BUILD_OS_INCLUDE_SUBIDR:=@OPENJDK_TARGET_OS_INCLUDE_SUBDIR@
+
 # Target platform value in ModuleTarget class file attribute.
 OPENJDK_MODULE_TARGET_PLATFORM:=@OPENJDK_MODULE_TARGET_PLATFORM@
 
@@ -175,6 +178,10 @@
 # Vendor version string
 VENDOR_VERSION_STRING := @VENDOR_VERSION_STRING@
 
+# Class-file version
+VERSION_CLASSFILE_MAJOR := @VERSION_CLASSFILE_MAJOR@
+VERSION_CLASSFILE_MINOR := @VERSION_CLASSFILE_MINOR@
+
 # Convenience CFLAGS settings for passing version information into native programs.
 VERSION_CFLAGS := \
     -DVERSION_FEATURE=$(VERSION_FEATURE) \
@@ -190,6 +197,8 @@
     -DVERSION_SPECIFICATION='"$(VERSION_SPECIFICATION)"' \
     -DVERSION_DATE='"$(VERSION_DATE)"' \
     -DVENDOR_VERSION_STRING='"$(VENDOR_VERSION_STRING)"' \
+    -DVERSION_CLASSFILE_MAJOR=$(VERSION_CLASSFILE_MAJOR) \
+    -DVERSION_CLASSFILE_MINOR=$(VERSION_CLASSFILE_MINOR) \
     #
 
 # Platform naming variables
@@ -540,7 +549,6 @@
 # versions of the variables directly.
 JAVA_CMD:=@JAVA@
 JAVAC_CMD:=@JAVAC@
-JAVAH_CMD:=@JAVAH@
 JAVADOC_CMD:=@JAVADOC@
 JAR_CMD:=@JAR@
 JLINK_CMD := @JLINK@
@@ -553,7 +561,6 @@
 JAVA_SMALL=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
 JAVA_JAVAC=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_JAVAC) $(JAVA_FLAGS)
 JAVAC=@FIXPATH@ $(JAVAC_CMD)
-JAVAH=@FIXPATH@ $(JAVAH_CMD)
 JAVADOC=@FIXPATH@ $(JAVADOC_CMD)
 JAR=@FIXPATH@ $(JAR_CMD)
 JLINK = @FIXPATH@ $(JLINK_CMD) $(JAVA_TOOL_FLAGS_SMALL)
@@ -578,6 +585,8 @@
 INTERIM_LANGTOOLS_MODULES := $(addsuffix .interim, $(INTERIM_LANGTOOLS_BASE_MODULES))
 INTERIM_LANGTOOLS_ADD_EXPORTS := \
     --add-exports java.base/sun.reflect.annotation=jdk.compiler.interim \
+    --add-exports java.base/jdk.internal.jmod=jdk.compiler.interim \
+    --add-exports java.base/jdk.internal.misc=jdk.compiler.interim \
     #
 INTERIM_LANGTOOLS_MODULES_COMMA := $(strip $(subst $(SPACE),$(COMMA),$(strip \
     $(INTERIM_LANGTOOLS_MODULES))))
@@ -717,7 +726,7 @@
 # Directories containing architecture-dependent files should be relative to exec_prefix
 INSTALL_EXECPREFIX=@exec_prefix@
 
-# java,javac,javah,javap etc are installed here.
+# java,javac,javap etc are installed here.
 INSTALL_BINDIR=@bindir@
 
 # Read only architecture-independent data
--- a/make/autoconf/version-numbers	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/autoconf/version-numbers	Thu Jan 11 10:45:44 2018 +0100
@@ -30,6 +30,8 @@
 DEFAULT_VERSION_UPDATE=0
 DEFAULT_VERSION_PATCH=0
 DEFAULT_VERSION_DATE=2018-03-20
+DEFAULT_VERSION_CLASSFILE_MAJOR=55  # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
+DEFAULT_VERSION_CLASSFILE_MINOR=0
 
 LAUNCHER_NAME=openjdk
 PRODUCT_NAME=OpenJDK
--- a/make/common/JavaCompilation.gmk	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/common/JavaCompilation.gmk	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, 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
@@ -46,7 +46,7 @@
 # passed to SetupJavaCompilation. This name is used as variable prefix.
 #
 # Remaining parameters are named arguments. These include:
-#   JVM:=The jvm used to run the javac/javah command
+#   JVM:=The jvm used to run the javac command
 #   JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out
 #   FLAGS:=Flags to be supplied to javac
 #   SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
--- a/make/common/SetupJavaCompilers.gmk	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/common/SetupJavaCompilers.gmk	Thu Jan 11 10:45:44 2018 +0100
@@ -69,7 +69,7 @@
 $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
     JVM := $(JAVA_JAVAC), \
     JAVAC := $(NEW_JAVAC), \
-    FLAGS := -source 10 -target 10 --doclint-format html5 \
+    FLAGS := -source 11 -target 11 --doclint-format html5 \
         -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -79,7 +79,7 @@
 $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
     JVM := $(JAVA_JAVAC), \
     JAVAC := $(NEW_JAVAC), \
-    FLAGS := -source 10 -target 10 \
+    FLAGS := -source 11 -target 11 \
         -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/make/conf/jib-profiles.js	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/conf/jib-profiles.js	Thu Jan 11 10:45:44 2018 +0100
@@ -829,7 +829,7 @@
         jtreg: {
             server: "javare",
             revision: "4.2",
-            build_number: "b10",
+            build_number: "b11",
             checksum_file: "MD5_VALUES",
             file: "jtreg_bin-4.2.zip",
             environment_name: "JT_HOME",
--- a/make/copy/Copy-java.base.gmk	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/copy/Copy-java.base.gmk	Thu Jan 11 10:45:44 2018 +0100
@@ -24,6 +24,7 @@
 #
 
 include CopyCommon.gmk
+include TextFileProcessing.gmk
 
 $(eval $(call IncludeCustomExtension, copy/Copy-java.base.gmk))
 
@@ -244,3 +245,16 @@
 endif
 
 ################################################################################
+# Generate classfile_constants.h
+
+$(eval $(call SetupTextFileProcessing, CREATE_CLASSFILE_CONSTANTS_H, \
+    SOURCE_FILES := $(TOPDIR)/src/java.base/share/native/include/classfile_constants.h.template, \
+    OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/modules_include/java.base/classfile_constants.h, \
+    REPLACEMENTS := \
+        @@VERSION_CLASSFILE_MAJOR@@ => $(VERSION_CLASSFILE_MAJOR) ; \
+        @@VERSION_CLASSFILE_MINOR@@ => $(VERSION_CLASSFILE_MINOR) ; , \
+))
+
+TARGETS += $(CREATE_CLASSFILE_CONSTANTS_H)
+
+################################################################################
--- a/make/copy/CopyCommon.gmk	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/copy/CopyCommon.gmk	Thu Jan 11 10:45:44 2018 +0100
@@ -39,20 +39,12 @@
   $(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE, \
       SRC := $(INCLUDE_SOURCE_DIR), \
       DEST := $(INCLUDE_TARGET_DIR), \
-      FILES := $(shell $(FIND) $(INCLUDE_SOURCE_DIR) -type f), \
+      FILES := $(filter %.h, $(call CacheFind, $(INCLUDE_SOURCE_DIR))), \
   ))
 
   TARGETS += $(COPY_EXPORTED_INCLUDE)
 endif
 
-# For historical reasons, the OS include directories have odd names.
-INCLUDE_TARGET_OS_SUBDIR := $(OPENJDK_TARGET_OS)
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  INCLUDE_TARGET_OS_SUBDIR := win32
-else ifeq ($(OPENJDK_TARGET_OS), macosx)
-  INCLUDE_TARGET_OS_SUBDIR := darwin
-endif
-
 # Use the most specific of OS and OS_TYPE.
 INCLUDE_SOURCE_OS_DIR := $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS)/native/include
 ifeq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
@@ -62,8 +54,8 @@
 ifneq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
   $(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE_OS, \
       SRC := $(INCLUDE_SOURCE_OS_DIR), \
-      DEST := $(INCLUDE_TARGET_DIR)/$(INCLUDE_TARGET_OS_SUBDIR), \
-      FILES := $(shell $(FIND) $(INCLUDE_SOURCE_OS_DIR) -type f), \
+      DEST := $(INCLUDE_TARGET_DIR)/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR), \
+      FILES := $(filter %.h, $(call CacheFind, $(INCLUDE_SOURCE_OS_DIR))), \
   ))
 
   TARGETS += $(COPY_EXPORTED_INCLUDE_OS)
--- a/make/gensrc/Gensrc-jdk.compiler.gmk	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/gensrc/Gensrc-jdk.compiler.gmk	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2017, 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
@@ -28,11 +28,8 @@
 $(eval $(call SetupVersionProperties,JAVAC_VERSION, \
     com/sun/tools/javac/resources/version.properties))
 
-$(eval $(call SetupVersionProperties,JAVAH_VERSION, \
-    com/sun/tools/javah/resources/version.properties))
-
 $(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
-    $(JAVAC_VERSION) $(JAVAH_VERSION)))
+    $(JAVAC_VERSION)))
 
 $(eval $(call SetupParseProperties,PARSE_PROPERTIES, \
 	com/sun/tools/javac/resources/compiler.properties))
--- a/make/gensrc/GensrcX11Wrappers.gmk	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/gensrc/GensrcX11Wrappers.gmk	Thu Jan 11 10:45:44 2018 +0100
@@ -92,10 +92,10 @@
   endif
 
   SIZER_CFLAGS := \
-      -I${TOPDIR}/src/hotspot/share/include \
-      -I${TOPDIR}/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
-      -I$(TOPDIR)/src/java.base/share/native/include \
-      -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include \
+      -I$(TOPDIR)/src/hotspot/share/include \
+      -I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
+      -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
+      -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
       -I$(TOPDIR)/src/java.base/share/native/libjava \
       -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
--- a/make/hotspot/lib/CompileJvm.gmk	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/hotspot/lib/CompileJvm.gmk	Thu Jan 11 10:45:44 2018 +0100
@@ -59,8 +59,8 @@
     -I$(TOPDIR)/src/hotspot/share/precompiled \
     -I$(TOPDIR)/src/hotspot/share/include \
     -I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
-    -I$(TOPDIR)/src/java.base/share/native/include \
-    -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include \
+    -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
+    -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
     -I$(TOPDIR)/src/java.base/share/native/libjimage \
     #
 
--- a/make/jdk/src/classes/build/tools/blacklistedcertsconverter/BlacklistedCertsConverter.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/jdk/src/classes/build/tools/blacklistedcertsconverter/BlacklistedCertsConverter.java	Thu Jan 11 10:45:44 2018 +0100
@@ -4,7 +4,9 @@
  *
  * 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.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
--- a/make/jdk/src/classes/build/tools/generatelsrequivmaps/EquivMapsGenerator.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/jdk/src/classes/build/tools/generatelsrequivmaps/EquivMapsGenerator.java	Thu Jan 11 10:45:44 2018 +0100
@@ -4,7 +4,9 @@
  *
  * 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.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
--- a/make/langtools/build.properties	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/langtools/build.properties	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2017, 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
@@ -60,7 +60,6 @@
 tool.javac.main.class=com.sun.tools.javac.Main
 tool.javadoc.main.class=jdk.javadoc.internal.tool.Main
 tool.javap.main.class=com.sun.tools.javap.Main
-tool.javah.main.class=com.sun.tools.javah.Main
 tool.sjavac.main.class=com.sun.tools.sjavac.Main
 tool.jshell.main.class=jdk.internal.jshell.tool.JShellToolProvider
 
--- a/make/langtools/build.xml	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/langtools/build.xml	Thu Jan 11 10:45:44 2018 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  ~ Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+  ~ Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
   ~ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   ~
   ~ This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
  The output of the build is as follows:
 
  build
-   |-bin (scripts to invoke various tools, javac, javah etc.)
+   |-bin (scripts to invoke various tools, javac etc.)
    |-genrsc (generated sources - i.e. properties)
    |-modules (compiled classes in a modular layout)
    |-jtreg (test work/results)
@@ -254,7 +254,6 @@
         <build-tool name="javac"/>
         <build-tool name="javadoc"/>
         <build-tool name="javap"/>
-        <build-tool name="javah"/>
         <build-tool name="jdeps"/>
         <build-tool name="sjavac"/>
         <build-tool name="jshell"/>
--- a/make/langtools/intellij/runConfigurations/javah.xml	Wed Dec 20 11:57:20 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-<component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="javah" type="Application" factoryName="Application">
-    <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
-    <option name="MAIN_CLASS_NAME" value="com.sun.tools.javah.Main" />
-    <option name="VM_PARAMETERS" value='@XPATCH@ --add-exports=jdk.compiler/com.sun.tools.javah=ALL-UNNAMED' />
-    <option name="PROGRAM_PARAMETERS" value="" />
-    <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
-    <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
-    <option name="ALTERNATIVE_JRE_PATH" value="@IDEA_TARGET_JDK@" />
-    <option name="ENABLE_SWING_INSPECTOR" value="false" />
-    <option name="ENV_VARIABLES" />
-    <option name="PASS_PARENT_ENVS" value="true" />
-    <module name="langtools" />
-    <envs />
-    <RunnerSettings RunnerId="Run" />
-    <ConfigurationWrapper RunnerId="Run" />
-    <method>
-      <option name="Make" enabled="false" />
-      <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-all-classes" />
-    </method>
-  </configuration>
-</component>
--- a/make/langtools/netbeans/README	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/langtools/netbeans/README	Thu Jan 11 10:45:44 2018 +0100
@@ -7,7 +7,7 @@
 repository.
 
 The repository contains a number of tools:
-    javac, javadoc and its doclets, javah and javap.
+    javac, javadoc and its doclets, and javap.
 
 Build Properties.
 
--- a/make/langtools/test/HelloWorld.apt.gold.txt	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/langtools/test/HelloWorld.apt.gold.txt	Thu Jan 11 10:45:44 2018 +0100
@@ -11,9 +11,4 @@
    * @param args The parameters are ignored.
    */
   public static void main(java.lang.String... args);
-
-  /**
-   * This declaration is for the benefit of javah tests.
-   */
-  public native void test();
 }
--- a/make/langtools/test/HelloWorld.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/langtools/test/HelloWorld.java	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, 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
@@ -37,9 +37,4 @@
     public static void main(String... args) {
         System.out.println("Hello World!");
     }
-
-    /**
-     * This declaration is for the benefit of javah tests.
-     */
-    public native void test();
 }
--- a/make/langtools/test/bootstrap/javah.sh	Wed Dec 20 11:57:20 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @summary Verify the basic execution of the bootstrap javah tool.
-
-TESTSRC=${TESTSRC:-.}
-TOPDIR=${TESTSRC}/../../..
-
-${TOPDIR}/dist/bootstrap/bin/javac -d . "${TESTSRC}"/../HelloWorld.java
-${TOPDIR}/dist/bootstrap/bin/javah -classpath . -d . HelloWorld
-
-if diff ${TESTSRC}/../HelloWorld.gold.h HelloWorld.h ; then
-    echo "Test passed."
-else
-    echo "Test failed."
-    exit 1
-fi
--- a/make/langtools/test/contents.gold.txt	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/langtools/test/contents.gold.txt	Thu Jan 11 10:45:44 2018 +0100
@@ -1,9 +1,7 @@
 ./bootstrap/bin/javac
 ./bootstrap/bin/javadoc
-./bootstrap/bin/javah
 ./bootstrap/lib/doclets.jar
 ./bootstrap/lib/javac.jar
 ./bootstrap/lib/javadoc.jar
-./bootstrap/lib/javah.jar
 ./lib/classes.jar
 ./lib/src.zip
--- a/make/langtools/test/lib/classes.gold.txt	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/langtools/test/lib/classes.gold.txt	Thu Jan 11 10:45:44 2018 +0100
@@ -1,9 +1,4 @@
 META-INF/MANIFEST.MF
-com/sun/tools/apt/Main.class
-com/sun/tools/apt/main/Main.class
-com/sun/tools/apt/resources/apt.class
-com/sun/tools/apt/resources/apt_ja.class
-com/sun/tools/apt/resources/apt_zh_CN.class
 com/sun/tools/doclets/formats/html/resources/standard.class
 com/sun/tools/doclets/formats/html/resources/standard_ja.class
 com/sun/tools/doclets/formats/html/resources/standard_zh_CN.class
@@ -26,13 +21,3 @@
 com/sun/tools/javadoc/resources/javadoc.class
 com/sun/tools/javadoc/resources/javadoc_ja.class
 com/sun/tools/javadoc/resources/javadoc_zh_CN.class
-com/sun/tools/javah/Main.class
-com/sun/tools/javah/resources/Linux_ppc.class
-com/sun/tools/javah/resources/Linux_sparc.class
-com/sun/tools/javah/resources/SunOS_sparc.class
-com/sun/tools/javah/resources/SunOS_sparcv9.class
-com/sun/tools/javah/resources/l10n.class
-com/sun/tools/javah/resources/l10n_ja.class
-com/sun/tools/javah/resources/l10n_zh_CN.class
-com/sun/tools/javah/resources/win32_x86.class
-sun/tools/javap/Main.class
--- a/make/langtools/test/lib/javah.sh	Wed Dec 20 11:57:20 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @summary Verify the basic execution of the javah classes in classes.jar.
-
-TESTSRC=${TESTSRC:-.}
-TOPDIR=${TESTSRC}/../../..
-TESTJAVAEXE="${TESTJAVA:+${TESTJAVA}/bin/}java"
-
-"${TESTJAVAEXE}" -Xbootclasspath/p:${TOPDIR}/dist/lib/classes.jar \
-    com.sun.tools.javac.Main \
-    -d . "${TESTSRC}"/../HelloWorld.java
-
-"${TESTJAVAEXE}" -Xbootclasspath/p:${TOPDIR}/dist/lib/classes.jar \
-    com.sun.tools.javah.Main \
-    -classpath . -d . HelloWorld
-
-if diff ${TESTSRC}/../HelloWorld.gold.h HelloWorld.h ; then
-    echo "Test passed."
-else
-    echo "Test failed."
-    exit 1
-fi
--- a/make/langtools/test/lib/src.gold.txt	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/langtools/test/lib/src.gold.txt	Thu Jan 11 10:45:44 2018 +0100
@@ -29,15 +29,5 @@
 com/sun/tools/javadoc/resources/javadoc.properties
 com/sun/tools/javadoc/resources/javadoc_ja.properties
 com/sun/tools/javadoc/resources/javadoc_zh_CN.properties
-com/sun/tools/javah/Main.java
-com/sun/tools/javah/resources/Linux_ppc.properties
-com/sun/tools/javah/resources/Linux_sparc.properties
-com/sun/tools/javah/resources/SunOS_sparc.properties
-com/sun/tools/javah/resources/SunOS_sparcv9.properties
-com/sun/tools/javah/resources/l10n.properties
-com/sun/tools/javah/resources/l10n_ja.properties
-com/sun/tools/javah/resources/l10n_zh_CN.properties
-com/sun/tools/javah/resources/win32_x86.properties
 javax/lang/model/overview.html
 javax/tools/overview.html
-sun/tools/javap/Main.java
--- a/make/langtools/tools/anttasks/SelectToolTask.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/langtools/tools/anttasks/SelectToolTask.java	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,6 @@
         NONE(""),
         JAVAC("javac"),
         JAVADOC("javadoc"),
-        JAVAH("javah"),
         JAVAP("javap"),
         JSHELL("jshell");
 
--- a/make/nb_native/nbproject/configurations.xml	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/nb_native/nbproject/configurations.xml	Thu Jan 11 10:45:44 2018 +0100
@@ -6670,18 +6670,6 @@
                 <in>examples.not-yet.txt</in>
               </df>
             </df>
-            <df name="javah">
-              <df name="6572945">
-                <df name="gold">
-                  <df name="jni.dir.1">
-                    <in>TestClass1.h</in>
-                    <in>TestClass1_Inner1.h</in>
-                    <in>TestClass1_Inner2.h</in>
-                    <in>TestClass2.h</in>
-                  </df>
-                </df>
-              </df>
-            </df>
             <df name="jdeprscan">
               <df name="tests">
                 <df name="jdk">
@@ -40851,26 +40839,6 @@
             tool="3"
             flavor2="0">
       </item>
-      <item path="../../test/langtools/tools/javah/6572945/gold/jni.dir.1/TestClass1.h"
-            ex="false"
-            tool="3"
-            flavor2="0">
-      </item>
-      <item path="../../test/langtools/tools/javah/6572945/gold/jni.dir.1/TestClass1_Inner1.h"
-            ex="false"
-            tool="3"
-            flavor2="0">
-      </item>
-      <item path="../../test/langtools/tools/javah/6572945/gold/jni.dir.1/TestClass1_Inner2.h"
-            ex="false"
-            tool="3"
-            flavor2="0">
-      </item>
-      <item path="../../test/langtools/tools/javah/6572945/gold/jni.dir.1/TestClass2.h"
-            ex="false"
-            tool="3"
-            flavor2="0">
-      </item>
       <item path="../../test/langtools/tools/jdeprscan/tests/jdk/jdeprscan/TestScanExpected.txt"
             ex="false"
             tool="3"
--- a/make/scripts/compare_exceptions.sh.incl	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/scripts/compare_exceptions.sh.incl	Thu Jan 11 10:45:44 2018 +0100
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2017, 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,7 +63,6 @@
       ./bin/java
       ./bin/javac
       ./bin/javadoc
-      ./bin/javah
       ./bin/javap
       ./bin/jdeps
       ./bin/jcmd
@@ -197,7 +196,6 @@
       ./bin/java
       ./bin/javac
       ./bin/javadoc
-      ./bin/javah
       ./bin/javap
       ./bin/jdeps
       ./bin/jcmd
@@ -306,7 +304,6 @@
       ./bin/java
       ./bin/javac
       ./bin/javadoc
-      ./bin/javah
       ./bin/javap
       ./bin/jdeps
       ./bin/jcmd
@@ -394,7 +391,6 @@
       ./bin/java.exe
       ./bin/javac.exe
       ./bin/javadoc.exe
-      ./bin/javah.exe
       ./bin/javap.exe
       ./bin/jdeps.exe
       ./bin/javaw.exe
@@ -486,7 +482,6 @@
       ./bin/java
       ./bin/javac
       ./bin/javadoc
-      ./bin/javah
       ./bin/javap
       ./bin/javaws
       ./bin/jdeps
--- a/make/test/JtregNativeHotspot.gmk	Wed Dec 20 11:57:20 2017 +0100
+++ b/make/test/JtregNativeHotspot.gmk	Thu Jan 11 10:45:44 2018 +0100
@@ -113,6 +113,8 @@
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libHandshakeTransitionTest := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libHasNoEntryPoint := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libReturnError := -lc
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libCNLookUp := -lc
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libTestCheckedEnsureLocalCapacity := -lc
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -3742,13 +3742,16 @@
 }
 
 void  MacroAssembler::set_narrow_oop(Register dst, jobject obj) {
-  assert (UseCompressedOops, "should only be used for compressed oops");
-  assert (Universe::heap() != NULL, "java heap should be initialized");
-  assert (oop_recorder() != NULL, "this assembler needs an OopRecorder");
-
+#ifdef ASSERT
+  {
+    ThreadInVMfromUnknown tiv;
+    assert (UseCompressedOops, "should only be used for compressed oops");
+    assert (Universe::heap() != NULL, "java heap should be initialized");
+    assert (oop_recorder() != NULL, "this assembler needs an OopRecorder");
+    assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(obj)), "should be real oop");
+  }
+#endif
   int oop_index = oop_recorder()->find_index(obj);
-  assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(obj)), "should be real oop");
-
   InstructionMark im(this);
   RelocationHolder rspec = oop_Relocation::spec(oop_index);
   code_section()->relocate(inst_mark(), rspec);
@@ -4006,8 +4009,13 @@
   if (obj == NULL) {
     oop_index = oop_recorder()->allocate_oop_index(obj);
   } else {
+#ifdef ASSERT
+    {
+      ThreadInVMfromUnknown tiv;
+      assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(obj)), "should be real oop");
+    }
+#endif
     oop_index = oop_recorder()->find_index(obj);
-    assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(obj)), "should be real oop");
   }
   RelocationHolder rspec = oop_Relocation::spec(oop_index);
   if (! immediate) {
@@ -4030,8 +4038,13 @@
 }
 
 Address MacroAssembler::constant_oop_address(jobject obj) {
-  assert(oop_recorder() != NULL, "this assembler needs an OopRecorder");
-  assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(obj)), "not an oop");
+#ifdef ASSERT
+  {
+    ThreadInVMfromUnknown tiv;
+    assert(oop_recorder() != NULL, "this assembler needs an OopRecorder");
+    assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(obj)), "not an oop");
+  }
+#endif
   int oop_index = oop_recorder()->find_index(obj);
   return Address((address)obj, oop_Relocation::spec(oop_index));
 }
--- a/src/hotspot/cpu/s390/templateTable_s390.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/cpu/s390/templateTable_s390.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -3722,7 +3722,6 @@
   Label slow_case;
   Label done;
   Label initialize_header;
-  Label initialize_object; // Including clearing the fields.
   Label allocate_shared;
 
   BLOCK_COMMENT("TemplateTable::_new {");
@@ -3760,65 +3759,41 @@
 
   // Allocate the instance
   // 1) Try to allocate in the TLAB.
-  // 2) If fail and the object is large allocate in the shared Eden.
-  // 3) If the above fails (or is not applicable), go to a slow case
+  // 2) If the above fails (or is not applicable), go to a slow case
   // (creates a new TLAB, etc.).
-
-  // Always go the slow path. See comment above this template.
-  const bool allow_shared_alloc = false;
-
+  // Note: compared to other architectures, s390's implementation always goes
+  // to the slow path if TLAB is used and fails.
   if (UseTLAB) {
     Register RoldTopValue = RallocatedObject;
     Register RnewTopValue = tmp;
     __ z_lg(RoldTopValue, Address(Z_thread, JavaThread::tlab_top_offset()));
     __ load_address(RnewTopValue, Address(RoldTopValue, Rsize));
     __ z_cg(RnewTopValue, Address(Z_thread, JavaThread::tlab_end_offset()));
-    __ z_brh(allow_shared_alloc ? allocate_shared : slow_case);
+    __ z_brh(slow_case);
     __ z_stg(RnewTopValue, Address(Z_thread, JavaThread::tlab_top_offset()));
-    if (ZeroTLAB) {
-      // The fields have been already cleared.
-      __ z_bru(initialize_header);
-    } else {
-      // Initialize both the header and fields.
-      if (allow_shared_alloc) {
-        __ z_bru(initialize_object);
-      } else {
-        // Fallthrough to initialize_object, but assert that it is on fall through path.
-        prev_instr_address = __ pc();
-      }
-    }
-  }
-
-  if (allow_shared_alloc) {
-    // Allocation in shared Eden not implemented, because sapjvm allocation trace does not allow it.
-    Unimplemented();
-  }
-
-  if (UseTLAB) {
+
     Register RobjectFields = tmp;
     Register Rzero = Z_R1_scratch;
-
-    assert(ZeroTLAB || prev_instr_address == __ pc(),
-           "must not omit jump to initialize_object above, as it is not on the fall through path");
     __ clear_reg(Rzero, true /*whole reg*/, false); // Load 0L into Rzero. Don't set CC.
 
-    // The object is initialized before the header. If the object size is
-    // zero, go directly to the header initialization.
-    __ bind(initialize_object);
-    __ z_aghi(Rsize, (int)-sizeof(oopDesc)); // Subtract header size, set CC.
-    __ z_bre(initialize_header);             // Jump if size of fields is zero.
-
-    // Initialize object fields.
-    // See documentation for MVCLE instruction!!!
-    assert(RobjectFields->encoding() % 2 == 0, "RobjectFields must be an even register");
-    assert(Rsize->encoding() == (RobjectFields->encoding()+1),
-           "RobjectFields and Rsize must be a register pair");
-    assert(Rzero->encoding() % 2 == 1, "Rzero must be an odd register");
-
-    // Set Rzero to 0 and use it as src length, then mvcle will copy nothing
-    // and fill the object with the padding value 0.
-    __ add2reg(RobjectFields, sizeof(oopDesc), RallocatedObject);
-    __ move_long_ext(RobjectFields, as_Register(Rzero->encoding() - 1), 0);
+    if (!ZeroTLAB) {
+      // The object is initialized before the header. If the object size is
+      // zero, go directly to the header initialization.
+      __ z_aghi(Rsize, (int)-sizeof(oopDesc)); // Subtract header size, set CC.
+      __ z_bre(initialize_header);             // Jump if size of fields is zero.
+
+      // Initialize object fields.
+      // See documentation for MVCLE instruction!!!
+      assert(RobjectFields->encoding() % 2 == 0, "RobjectFields must be an even register");
+      assert(Rsize->encoding() == (RobjectFields->encoding()+1),
+             "RobjectFields and Rsize must be a register pair");
+      assert(Rzero->encoding() % 2 == 1, "Rzero must be an odd register");
+
+      // Set Rzero to 0 and use it as src length, then mvcle will copy nothing
+      // and fill the object with the padding value 0.
+      __ add2reg(RobjectFields, sizeof(oopDesc), RallocatedObject);
+      __ move_long_ext(RobjectFields, as_Register(Rzero->encoding() - 1), 0);
+    }
 
     // Initialize object header only.
     __ bind(initialize_header);
--- a/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -765,6 +765,11 @@
     0xfefa39efUL, 0x3fe62e42UL, 0xfefa39efUL, 0xbfe62e42UL
 };
 
+ALIGNED_(8) juint _DOUBLE2[] =
+{
+    0x00000000UL, 0x40000000UL
+};
+
 //registers,
 // input: xmm0, xmm1
 // scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7
@@ -803,6 +808,7 @@
   address HIGHMASK_LOG_X = (address)_HIGHMASK_LOG_X;
   address HALFMASK = (address)_HALFMASK;
   address log2 = (address)_log2_pow;
+  address DOUBLE2 = (address)_DOUBLE2;
 
 
   bind(start);
@@ -810,6 +816,13 @@
   movsd(Address(rsp, 8), xmm0);
   movsd(Address(rsp, 16), xmm1);
 
+  // Special case: pow(x, 2.0) => x * x
+  movdq(tmp1, xmm1);
+  cmp64(tmp1, ExternalAddress(DOUBLE2));
+  jccb(Assembler::notEqual, B1_2);
+  mulsd(xmm0, xmm0);
+  jmp(B1_5);
+
   bind(B1_2);
   pextrw(eax, xmm0, 3);
   xorpd(xmm2, xmm2);
--- a/src/hotspot/cpu/x86/vm_version_x86.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/cpu/x86/vm_version_x86.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -882,7 +882,7 @@
     FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
   }
 
-  if (UseSHA) {
+  if (UseSHA && supports_avx2() && supports_bmi2()) {
     if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
       FLAG_SET_DEFAULT(UseSHA512Intrinsics, true);
     }
--- a/src/hotspot/cpu/x86/x86_64.ad	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/cpu/x86/x86_64.ad	Thu Jan 11 10:45:44 2018 +0100
@@ -547,8 +547,12 @@
 
 #define __ _masm.
 
+static bool generate_vzeroupper(Compile* C) {
+  return (VM_Version::supports_vzeroupper() && (C->max_vector_size() > 16 || C->clear_upper_avx() == true)) ? true: false;  // Generate vzeroupper
+}
+
 static int clear_avx_size() {
-  return (VM_Version::supports_vzeroupper()) ? 3: 0;  // vzeroupper
+  return generate_vzeroupper(Compile::current()) ? 3: 0;  // vzeroupper
 }
 
 // !!!!! Special hack to get all types of calls to specify the byte offset
@@ -931,7 +935,7 @@
 void MachEpilogNode::format(PhaseRegAlloc* ra_, outputStream* st) const
 {
   Compile* C = ra_->C;
-  if (VM_Version::supports_vzeroupper()) {
+  if (generate_vzeroupper(C)) {
     st->print("vzeroupper");
     st->cr(); st->print("\t");
   }
@@ -971,9 +975,11 @@
   Compile* C = ra_->C;
   MacroAssembler _masm(&cbuf);
 
-  // Clear upper bits of YMM registers when current compiled code uses
-  // wide vectors to avoid AVX <-> SSE transition penalty during call.
-  __ vzeroupper();
+  if (generate_vzeroupper(C)) {
+    // Clear upper bits of YMM registers when current compiled code uses
+    // wide vectors to avoid AVX <-> SSE transition penalty during call.
+    __ vzeroupper();
+  }
 
   int framesize = C->frame_size_in_bytes();
   assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned");
@@ -2112,11 +2118,13 @@
 
   enc_class clear_avx %{
     debug_only(int off0 = cbuf.insts_size());
-    // Clear upper bits of YMM registers to avoid AVX <-> SSE transition penalty
-    // Clear upper bits of YMM registers when current compiled code uses
-    // wide vectors to avoid AVX <-> SSE transition penalty during call.
-    MacroAssembler _masm(&cbuf);
-    __ vzeroupper();
+    if (generate_vzeroupper(Compile::current())) {
+      // Clear upper bits of YMM registers to avoid AVX <-> SSE transition penalty
+      // Clear upper bits of YMM registers when current compiled code uses
+      // wide vectors to avoid AVX <-> SSE transition penalty during call.
+      MacroAssembler _masm(&cbuf);
+      __ vzeroupper();
+    }
     debug_only(int off1 = cbuf.insts_size());
     assert(off1 - off0 == clear_avx_size(), "correct size prediction");
   %}
--- a/src/hotspot/os/linux/osContainer_linux.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/os/linux/osContainer_linux.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -31,16 +31,11 @@
 #include "logging/log.hpp"
 #include "osContainer_linux.hpp"
 
-/*
- * Warning: Some linux distros use 0x7FFFFFFFFFFFF000
- * and others use 0x7FFFFFFFFFFFFFFF for unlimited.
- */
-#define UNLIMITED_MEM CONST64(0x7FFFFFFFFFFFF000)
-
 #define PER_CPU_SHARES 1024
 
 bool  OSContainer::_is_initialized   = false;
 bool  OSContainer::_is_containerized = false;
+julong _unlimited_memory;
 
 class CgroupSubsystem: CHeapObj<mtInternal> {
  friend class OSContainer;
@@ -217,6 +212,8 @@
   _is_initialized = true;
   _is_containerized = false;
 
+  _unlimited_memory = (LONG_MAX / os::vm_page_size()) * os::vm_page_size();
+
   log_trace(os, container)("OSContainer::init: Initializing Container Support");
   if (!UseContainerSupport) {
     log_trace(os, container)("Container Support not enabled");
@@ -419,37 +416,37 @@
  *    OSCONTAINER_ERROR for not supported
  */
 jlong OSContainer::memory_limit_in_bytes() {
-  GET_CONTAINER_INFO(jlong, memory, "/memory.limit_in_bytes",
-                     "Memory Limit is: " JLONG_FORMAT, JLONG_FORMAT, memlimit);
+  GET_CONTAINER_INFO(julong, memory, "/memory.limit_in_bytes",
+                     "Memory Limit is: " JULONG_FORMAT, JULONG_FORMAT, memlimit);
 
-  if (memlimit >= UNLIMITED_MEM) {
+  if (memlimit >= _unlimited_memory) {
     log_trace(os, container)("Memory Limit is: Unlimited");
     return (jlong)-1;
   }
   else {
-    return memlimit;
+    return (jlong)memlimit;
   }
 }
 
 jlong OSContainer::memory_and_swap_limit_in_bytes() {
-  GET_CONTAINER_INFO(jlong, memory, "/memory.memsw.limit_in_bytes",
-                     "Memory and Swap Limit is: " JLONG_FORMAT, JLONG_FORMAT, memswlimit);
-  if (memswlimit >= UNLIMITED_MEM) {
+  GET_CONTAINER_INFO(julong, memory, "/memory.memsw.limit_in_bytes",
+                     "Memory and Swap Limit is: " JULONG_FORMAT, JULONG_FORMAT, memswlimit);
+  if (memswlimit >= _unlimited_memory) {
     log_trace(os, container)("Memory and Swap Limit is: Unlimited");
     return (jlong)-1;
   } else {
-    return memswlimit;
+    return (jlong)memswlimit;
   }
 }
 
 jlong OSContainer::memory_soft_limit_in_bytes() {
-  GET_CONTAINER_INFO(jlong, memory, "/memory.soft_limit_in_bytes",
-                     "Memory Soft Limit is: " JLONG_FORMAT, JLONG_FORMAT, memsoftlimit);
-  if (memsoftlimit >= UNLIMITED_MEM) {
+  GET_CONTAINER_INFO(julong, memory, "/memory.soft_limit_in_bytes",
+                     "Memory Soft Limit is: " JULONG_FORMAT, JULONG_FORMAT, memsoftlimit);
+  if (memsoftlimit >= _unlimited_memory) {
     log_trace(os, container)("Memory Soft Limit is: Unlimited");
     return (jlong)-1;
   } else {
-    return memsoftlimit;
+    return (jlong)memsoftlimit;
   }
 }
 
--- a/src/hotspot/share/ci/ciField.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/ci/ciField.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -256,7 +256,9 @@
   // Get the flags, offset, and canonical holder of the field.
   _flags = ciFlags(fd->access_flags());
   _offset = fd->offset();
-  _holder = CURRENT_ENV->get_instance_klass(fd->field_holder());
+  Klass* field_holder = fd->field_holder();
+  assert(field_holder != NULL, "null field_holder");
+  _holder = CURRENT_ENV->get_instance_klass(field_holder);
   _is_flattened = fd->is_flatten();
   assert(fd->field_type() == T_VALUETYPE || !_is_flattened, "flattening is only supported for value type fields");
 
--- a/src/hotspot/share/classfile/classFileParser.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -87,7 +87,6 @@
 
 #define JAVA_CLASSFILE_MAGIC              0xCAFEBABE
 #define JAVA_MIN_SUPPORTED_VERSION        45
-#define JAVA_MAX_SUPPORTED_VERSION        54
 #define JAVA_MAX_SUPPORTED_MINOR_VERSION  1
 
 // Used for two backward compatibility reasons:
@@ -111,6 +110,8 @@
 
 #define JAVA_10_VERSION                   54
 
+#define JAVA_11_VERSION                   55
+
 void ClassFileParser::set_class_bad_constant_seen(short bad_constant) {
   assert((bad_constant == 19 || bad_constant == 20) && _major_version >= JAVA_9_VERSION,
          "Unexpected bad constant pool entry");
@@ -4914,11 +4915,11 @@
 }
 
 static bool is_supported_version(u2 major, u2 minor) {
-  const u2 max_version = JAVA_MAX_SUPPORTED_VERSION;
+  const u2 max_version = JVM_CLASSFILE_MAJOR_VERSION;
   return (major >= JAVA_MIN_SUPPORTED_VERSION) &&
          (major <= max_version) &&
          ((major != max_version) ||
-          (minor <= JAVA_MAX_SUPPORTED_MINOR_VERSION));
+          (minor <= JVM_CLASSFILE_MINOR_VERSION));
 }
 
 void ClassFileParser::verify_legal_field_modifiers(jint flags,
@@ -6117,8 +6118,8 @@
       _class_name->as_C_string(),
       _major_version,
       _minor_version,
-      JAVA_MAX_SUPPORTED_VERSION,
-      JAVA_MAX_SUPPORTED_MINOR_VERSION);
+      JVM_CLASSFILE_MAJOR_VERSION,
+      JVM_CLASSFILE_MINOR_VERSION);
     return;
   }
 
--- a/src/hotspot/share/classfile/classListParser.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/classfile/classListParser.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -315,12 +315,13 @@
   return k;
 }
 
-InstanceKlass* ClassListParser::load_current_class(TRAPS) {
+Klass* ClassListParser::load_current_class(TRAPS) {
   TempNewSymbol class_name_symbol = SymbolTable::new_symbol(_class_name, THREAD);
   guarantee(!HAS_PENDING_EXCEPTION, "Exception creating a symbol.");
 
-  InstanceKlass *klass = NULL;
+  Klass *klass = NULL;
   if (!is_loading_from_source()) {
+    // Load classes for the boot/platform/app loaders only.
     if (is_super_specified()) {
       error("If source location is not specified, super class must not be specified");
     }
@@ -330,40 +331,36 @@
 
     bool non_array = !FieldType::is_array(class_name_symbol);
 
-    Handle s = java_lang_String::create_from_symbol(class_name_symbol, CHECK_0);
-    // Translate to external class name format, i.e., convert '/' chars to '.'
-    Handle string = java_lang_String::externalize_classname(s, CHECK_0);
     JavaValue result(T_OBJECT);
-    InstanceKlass* spec_klass =  non_array ?
-      SystemDictionary::ClassLoader_klass() : SystemDictionary::Class_klass();
-    Symbol* method_name = non_array ?
-      vmSymbols::loadClass_name() : vmSymbols::forName_name();
-    Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
+    if (non_array) {
+      // At this point, we are executing in the context of the boot loader. We
+      // cannot call Class.forName because that is context dependent and
+      // would load only classes for the boot loader.
+      //
+      // Instead, let's call java_system_loader().loadClass() directly, which will
+      // delegate to the correct loader (boot, platform or app) depending on
+      // the class name.
 
-    if (non_array) {
+      Handle s = java_lang_String::create_from_symbol(class_name_symbol, CHECK_0);
+      // ClassLoader.loadClass() wants external class name format, i.e., convert '/' chars to '.'
+      Handle ext_class_name = java_lang_String::externalize_classname(s, CHECK_0);
+      Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
+
       JavaCalls::call_virtual(&result,
                               loader, //SystemDictionary::java_system_loader(),
-                              spec_klass,
-                              method_name, //vmSymbols::loadClass_name(),
+                              SystemDictionary::ClassLoader_klass(),
+                              vmSymbols::loadClass_name(),
                               vmSymbols::string_class_signature(),
-                              string,
+                              ext_class_name,
                               THREAD);
     } else {
-      JavaCalls::call_static(&result,
-                             spec_klass,
-                             method_name,
-                             vmSymbols::string_class_signature(),
-                             string,
-                             CHECK_NULL);
+      // array classes are not supported in class list.
+      THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
     }
     assert(result.get_type() == T_OBJECT, "just checking");
     oop obj = (oop) result.get_jobject();
     if (!HAS_PENDING_EXCEPTION && (obj != NULL)) {
-      if (non_array) {
-        klass = InstanceKlass::cast(java_lang_Class::as_Klass(obj));
-      } else {
-        klass = static_cast<InstanceKlass*>(java_lang_Class::array_klass_acquire(obj));
-      }
+      klass = java_lang_Class::as_Klass(obj);
     } else { // load classes in bootclasspath/a
       if (HAS_PENDING_EXCEPTION) {
         CLEAR_PENDING_EXCEPTION;
@@ -372,7 +369,7 @@
       if (non_array) {
         Klass* k = SystemDictionary::resolve_or_null(class_name_symbol, CHECK_NULL);
         if (k != NULL) {
-          klass = InstanceKlass::cast(k);
+          klass = k;
         } else {
           if (!HAS_PENDING_EXCEPTION) {
             THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
@@ -388,14 +385,15 @@
     }
   }
 
-  if (klass != NULL && is_id_specified()) {
+  if (klass != NULL && klass->is_instance_klass() && is_id_specified()) {
+    InstanceKlass* ik = InstanceKlass::cast(klass);
     int id = this->id();
-    SystemDictionaryShared::update_shared_entry(klass, id);
+    SystemDictionaryShared::update_shared_entry(ik, id);
     InstanceKlass* old = table()->lookup(id);
-    if (old != NULL && old != klass) {
+    if (old != NULL && old != ik) {
       error("Duplicated ID %d for class %s", id, _class_name);
     }
-    table()->add(id, klass);
+    table()->add(id, ik);
   }
 
   return klass;
--- a/src/hotspot/share/classfile/classListParser.hpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/classfile/classListParser.hpp	Thu Jan 11 10:45:44 2018 +0100
@@ -136,7 +136,7 @@
     return _class_name;
   }
 
-  InstanceKlass* load_current_class(TRAPS);
+  Klass* load_current_class(TRAPS);
 
   bool is_loading_from_source();
 
--- a/src/hotspot/share/classfile/classLoaderData.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/classfile/classLoaderData.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -586,9 +586,9 @@
     ls.cr();
   }
 
-  // In some rare cases items added to this list will not be freed elsewhere.
-  // To keep it simple, just free everything in it here.
-  free_deallocate_list();
+  // Some items on the _deallocate_list need to free their C heap structures
+  // if they are not already on the _klasses list.
+  unload_deallocate_list();
 
   // Clean up global class iterator for compiler
   static_klass_iterator.adjust_saved_class(this);
@@ -767,6 +767,7 @@
 }
 
 void ClassLoaderData::remove_handle(OopHandle h) {
+  assert(!is_unloading(), "Do not remove a handle for a CLD that is unloading");
   oop* ptr = h.ptr_raw();
   if (ptr != NULL) {
     assert(_handles.contains(ptr), "Got unexpected handle " PTR_FORMAT, p2i(ptr));
@@ -811,6 +812,7 @@
 void ClassLoaderData::free_deallocate_list() {
   // Don't need lock, at safepoint
   assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
+  assert(!is_unloading(), "only called for ClassLoaderData that are not unloading");
   if (_deallocate_list == NULL) {
     return;
   }
@@ -844,6 +846,36 @@
   }
 }
 
+// This is distinct from free_deallocate_list.  For class loader data that are
+// unloading, this frees the C heap memory for items on the list, and unlinks
+// scratch or error classes so that unloading events aren't triggered for these
+// classes. The metadata is removed with the unloading metaspace.
+// There isn't C heap memory allocated for methods, so nothing is done for them.
+void ClassLoaderData::unload_deallocate_list() {
+  // Don't need lock, at safepoint
+  assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
+  assert(is_unloading(), "only called for ClassLoaderData that are unloading");
+  if (_deallocate_list == NULL) {
+    return;
+  }
+  // Go backwards because this removes entries that are freed.
+  for (int i = _deallocate_list->length() - 1; i >= 0; i--) {
+    Metadata* m = _deallocate_list->at(i);
+    assert (!m->on_stack(), "wouldn't be unloading if this were so");
+    _deallocate_list->remove_at(i);
+    if (m->is_constantPool()) {
+      ((ConstantPool*)m)->release_C_heap_structures();
+    } else if (m->is_klass()) {
+      InstanceKlass* ik = (InstanceKlass*)m;
+      // also releases ik->constants() C heap memory
+      InstanceKlass::release_C_heap_structures(ik);
+      // Remove the class so unloading events aren't triggered for
+      // this class (scratch or error class) in do_unloading().
+      remove_class(ik);
+    }
+  }
+}
+
 // These anonymous class loaders are to contain classes used for JSR292
 ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) {
   // Add a new class loader data to the graph.
--- a/src/hotspot/share/classfile/classLoaderData.hpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/classfile/classLoaderData.hpp	Thu Jan 11 10:45:44 2018 +0100
@@ -308,7 +308,8 @@
   void packages_do(void f(PackageEntry*));
 
   // Deallocate free list during class unloading.
-  void free_deallocate_list();
+  void free_deallocate_list();      // for the classes that are not unloaded
+  void unload_deallocate_list();    // for the classes that are unloaded
 
   // Allocate out of this class loader data
   MetaWord* allocate(size_t size);
--- a/src/hotspot/share/classfile/vmSymbols.hpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/classfile/vmSymbols.hpp	Thu Jan 11 10:45:44 2018 +0100
@@ -1007,8 +1007,8 @@
    do_name(     montgomerySquare_name,                             "implMontgomerySquare")                              \
    do_signature(montgomerySquare_signature,                        "([I[IIJ[I)[I")                                      \
                                                                                                                         \
-  do_class(java_util_ArraysSupport, "java/util/ArraysSupport")                                                          \
-  do_intrinsic(_vectorizedMismatch, java_util_ArraysSupport, vectorizedMismatch_name, vectorizedMismatch_signature, F_S)\
+  do_class(jdk_internal_util_ArraysSupport, "jdk/internal/util/ArraysSupport")                                                          \
+  do_intrinsic(_vectorizedMismatch, jdk_internal_util_ArraysSupport, vectorizedMismatch_name, vectorizedMismatch_signature, F_S)\
    do_name(vectorizedMismatch_name, "vectorizedMismatch")                                                               \
    do_signature(vectorizedMismatch_signature, "(Ljava/lang/Object;JLjava/lang/Object;JII)I")                            \
                                                                                                                         \
--- a/src/hotspot/share/compiler/compileBroker.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/compiler/compileBroker.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -1870,18 +1870,24 @@
     TraceTime t1("compilation", &time);
     EventCompilation event;
 
-    JVMCIEnv env(task, system_dictionary_modification_counter);
-    methodHandle method(thread, target_handle);
-    jvmci->compile_method(method, osr_bci, &env);
+    // Skip redefined methods
+    if (target_handle->is_old()) {
+        failure_reason = "redefined method";
+        retry_message = "not retryable";
+        compilable = ciEnv::MethodCompilable_never;
+    } else {
+        JVMCIEnv env(task, system_dictionary_modification_counter);
+        methodHandle method(thread, target_handle);
+        jvmci->compile_method(method, osr_bci, &env);
 
+        failure_reason = env.failure_reason();
+        if (!env.retryable()) {
+          retry_message = "not retryable";
+          compilable = ciEnv::MethodCompilable_not_at_tier;
+        }
+    }
     post_compile(thread, task, event, task->code() != NULL, NULL);
 
-    failure_reason = env.failure_reason();
-    if (!env.retryable()) {
-      retry_message = "not retryable";
-      compilable = ciEnv::MethodCompilable_not_at_tier;
-    }
-
   } else
 #endif // INCLUDE_JVMCI
   {
--- a/src/hotspot/share/gc/g1/g1AllocRegion.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/gc/g1/g1AllocRegion.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,17 +42,17 @@
 
   // Make sure that any allocation attempt on this region will fail
   // and will not trigger any asserts.
-  assert(allocate(dummy_region, 1, false) == NULL, "should fail");
-  assert(par_allocate(dummy_region, 1, false) == NULL, "should fail");
-  assert(allocate(dummy_region, 1, true) == NULL, "should fail");
-  assert(par_allocate(dummy_region, 1, true) == NULL, "should fail");
+  assert(dummy_region->allocate_no_bot_updates(1) == NULL, "should fail");
+  assert(dummy_region->allocate(1) == NULL, "should fail");
+  DEBUG_ONLY(size_t assert_tmp);
+  assert(dummy_region->par_allocate_no_bot_updates(1, 1, &assert_tmp) == NULL, "should fail");
+  assert(dummy_region->par_allocate(1, 1, &assert_tmp) == NULL, "should fail");
 
   _g1h = g1h;
   _dummy_region = dummy_region;
 }
 
-size_t G1AllocRegion::fill_up_remaining_space(HeapRegion* alloc_region,
-                                              bool bot_updates) {
+size_t G1AllocRegion::fill_up_remaining_space(HeapRegion* alloc_region) {
   assert(alloc_region != NULL && alloc_region != _dummy_region,
          "pre-condition");
   size_t result = 0;
@@ -74,7 +74,7 @@
   size_t min_word_size_to_fill = CollectedHeap::min_fill_size();
 
   while (free_word_size >= min_word_size_to_fill) {
-    HeapWord* dummy = par_allocate(alloc_region, free_word_size, bot_updates);
+    HeapWord* dummy = par_allocate(alloc_region, free_word_size);
     if (dummy != NULL) {
       // If the allocation was successful we should fill in the space.
       CollectedHeap::fill_with_object(dummy, free_word_size);
@@ -110,7 +110,7 @@
                            "the alloc region should never be empty");
 
     if (fill_up) {
-      result = fill_up_remaining_space(alloc_region, _bot_updates);
+      result = fill_up_remaining_space(alloc_region);
     }
 
     assert_alloc_region(alloc_region->used() >= _used_bytes_before, "invariant");
@@ -135,7 +135,7 @@
     new_alloc_region->reset_pre_dummy_top();
     // Need to do this before the allocation
     _used_bytes_before = new_alloc_region->used();
-    HeapWord* result = allocate(new_alloc_region, word_size, _bot_updates);
+    HeapWord* result = allocate(new_alloc_region, word_size);
     assert_alloc_region(result != NULL, "the allocation should succeeded");
 
     OrderAccess::storestore();
@@ -301,7 +301,7 @@
       // possible object. In this case this region will not be retained, so the
       // original problem cannot occur.
       if (to_allocate_words >= G1CollectedHeap::min_fill_size()) {
-        HeapWord* dummy = attempt_allocation(to_allocate_words, true /* bot_updates */);
+        HeapWord* dummy = attempt_allocation(to_allocate_words);
         CollectedHeap::fill_with_object(dummy, to_allocate_words);
       }
     }
--- a/src/hotspot/share/gc/g1/g1AllocRegion.hpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/gc/g1/g1AllocRegion.hpp	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, 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
@@ -83,37 +83,27 @@
   // whether the _alloc_region is NULL or not.
   static HeapRegion* _dummy_region;
 
-  // Some of the methods below take a bot_updates parameter. Its value
-  // should be the same as the _bot_updates field. The idea is that
-  // the parameter will be a constant for a particular alloc region
-  // and, given that these methods will be hopefully inlined, the
-  // compiler should compile out the test.
-
   // Perform a non-MT-safe allocation out of the given region.
-  static inline HeapWord* allocate(HeapRegion* alloc_region,
-                                   size_t word_size,
-                                   bool bot_updates);
+  inline HeapWord* allocate(HeapRegion* alloc_region,
+                            size_t word_size);
 
   // Perform a MT-safe allocation out of the given region.
-  static inline HeapWord* par_allocate(HeapRegion* alloc_region,
-                                       size_t word_size,
-                                       bool bot_updates);
+  inline HeapWord* par_allocate(HeapRegion* alloc_region,
+                                size_t word_size);
   // Perform a MT-safe allocation out of the given region, with the given
   // minimum and desired size. Returns the actual size allocated (between
   // minimum and desired size) in actual_word_size if the allocation has been
   // successful.
-  static inline HeapWord* par_allocate(HeapRegion* alloc_region,
-                                       size_t min_word_size,
-                                       size_t desired_word_size,
-                                       size_t* actual_word_size,
-                                       bool bot_updates);
+  inline HeapWord* par_allocate(HeapRegion* alloc_region,
+                                size_t min_word_size,
+                                size_t desired_word_size,
+                                size_t* actual_word_size);
 
   // Ensure that the region passed as a parameter has been filled up
   // so that noone else can allocate out of it any more.
   // Returns the number of bytes that have been wasted by filled up
   // the space.
-  static size_t fill_up_remaining_space(HeapRegion* alloc_region,
-                                        bool bot_updates);
+  size_t fill_up_remaining_space(HeapRegion* alloc_region);
 
   // After a region is allocated by alloc_new_region, this
   // method is used to set it as the active alloc_region
@@ -160,8 +150,7 @@
   // First-level allocation: Should be called without holding a
   // lock. It will try to allocate lock-free out of the active region,
   // or return NULL if it was unable to.
-  inline HeapWord* attempt_allocation(size_t word_size,
-                                      bool bot_updates);
+  inline HeapWord* attempt_allocation(size_t word_size);
   // Perform an allocation out of the current allocation region, with the given
   // minimum and desired size. Returns the actual size allocated (between
   // minimum and desired size) in actual_word_size if the allocation has been
@@ -170,8 +159,7 @@
   // out of the active region, or return NULL if it was unable to.
   inline HeapWord* attempt_allocation(size_t min_word_size,
                                       size_t desired_word_size,
-                                      size_t* actual_word_size,
-                                      bool bot_updates);
+                                      size_t* actual_word_size);
 
   // Second-level allocation: Should be called while holding a
   // lock. It will try to first allocate lock-free out of the active
@@ -179,23 +167,20 @@
   // alloc region with a new one. We require that the caller takes the
   // appropriate lock before calling this so that it is easier to make
   // it conform to its locking protocol.
-  inline HeapWord* attempt_allocation_locked(size_t word_size,
-                                             bool bot_updates);
+  inline HeapWord* attempt_allocation_locked(size_t word_size);
   // Same as attempt_allocation_locked(size_t, bool), but allowing specification
   // of minimum word size of the block in min_word_size, and the maximum word
   // size of the allocation in desired_word_size. The actual size of the block is
   // returned in actual_word_size.
   inline HeapWord* attempt_allocation_locked(size_t min_word_size,
                                              size_t desired_word_size,
-                                             size_t* actual_word_size,
-                                             bool bot_updates);
+                                             size_t* actual_word_size);
 
   // Should be called to allocate a new region even if the max of this
   // type of regions has been reached. Should only be called if other
   // allocation attempts have failed and we are not holding a valid
   // active region.
-  inline HeapWord* attempt_allocation_force(size_t word_size,
-                                            bool bot_updates);
+  inline HeapWord* attempt_allocation_force(size_t word_size);
 
   // Should be called before we start using this object.
   void init();
@@ -236,7 +221,7 @@
   virtual void retire_region(HeapRegion* alloc_region, size_t allocated_bytes);
 
   virtual size_t retire(bool fill_up);
-public:
+
   G1GCAllocRegion(const char* name, bool bot_updates, G1EvacStats* stats, InCSetState::in_cset_state_t purpose)
   : G1AllocRegion(name, bot_updates), _stats(stats), _purpose(purpose) {
     assert(stats != NULL, "Must pass non-NULL PLAB statistics");
--- a/src/hotspot/share/gc/g1/g1AllocRegion.inline.hpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/gc/g1/g1AllocRegion.inline.hpp	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, 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
@@ -37,52 +37,47 @@
 
 
 inline HeapWord* G1AllocRegion::allocate(HeapRegion* alloc_region,
-                                         size_t word_size,
-                                         bool bot_updates) {
+                                         size_t word_size) {
   assert(alloc_region != NULL, "pre-condition");
 
-  if (!bot_updates) {
+  if (!_bot_updates) {
     return alloc_region->allocate_no_bot_updates(word_size);
   } else {
     return alloc_region->allocate(word_size);
   }
 }
 
-inline HeapWord* G1AllocRegion::par_allocate(HeapRegion* alloc_region, size_t word_size, bool bot_updates) {
+inline HeapWord* G1AllocRegion::par_allocate(HeapRegion* alloc_region, size_t word_size) {
   size_t temp;
-  return par_allocate(alloc_region, word_size, word_size, &temp, bot_updates);
+  return par_allocate(alloc_region, word_size, word_size, &temp);
 }
 
 inline HeapWord* G1AllocRegion::par_allocate(HeapRegion* alloc_region,
                                              size_t min_word_size,
                                              size_t desired_word_size,
-                                             size_t* actual_word_size,
-                                             bool bot_updates) {
+                                             size_t* actual_word_size) {
   assert(alloc_region != NULL, "pre-condition");
   assert(!alloc_region->is_empty(), "pre-condition");
 
-  if (!bot_updates) {
+  if (!_bot_updates) {
     return alloc_region->par_allocate_no_bot_updates(min_word_size, desired_word_size, actual_word_size);
   } else {
     return alloc_region->par_allocate(min_word_size, desired_word_size, actual_word_size);
   }
 }
 
-inline HeapWord* G1AllocRegion::attempt_allocation(size_t word_size, bool bot_updates) {
+inline HeapWord* G1AllocRegion::attempt_allocation(size_t word_size) {
   size_t temp;
-  return attempt_allocation(word_size, word_size, &temp, bot_updates);
+  return attempt_allocation(word_size, word_size, &temp);
 }
 
 inline HeapWord* G1AllocRegion::attempt_allocation(size_t min_word_size,
                                                    size_t desired_word_size,
-                                                   size_t* actual_word_size,
-                                                   bool bot_updates) {
-  assert_alloc_region(bot_updates == _bot_updates, "pre-condition");
-
+                                                   size_t* actual_word_size) {
   HeapRegion* alloc_region = _alloc_region;
   assert_alloc_region(alloc_region != NULL, "not initialized properly");
 
-  HeapWord* result = par_allocate(alloc_region, min_word_size, desired_word_size, actual_word_size, bot_updates);
+  HeapWord* result = par_allocate(alloc_region, min_word_size, desired_word_size, actual_word_size);
   if (result != NULL) {
     trace("alloc", min_word_size, desired_word_size, *actual_word_size, result);
     return result;
@@ -91,19 +86,18 @@
   return NULL;
 }
 
-inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t word_size, bool bot_updates) {
+inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t word_size) {
   size_t temp;
-  return attempt_allocation_locked(word_size, word_size, &temp, bot_updates);
+  return attempt_allocation_locked(word_size, word_size, &temp);
 }
 
 inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t min_word_size,
                                                           size_t desired_word_size,
-                                                          size_t* actual_word_size,
-                                                          bool bot_updates) {
+                                                          size_t* actual_word_size) {
   // First we have to redo the allocation, assuming we're holding the
   // appropriate lock, in case another thread changed the region while
   // we were waiting to get the lock.
-  HeapWord* result = attempt_allocation(min_word_size, desired_word_size, actual_word_size, bot_updates);
+  HeapWord* result = attempt_allocation(min_word_size, desired_word_size, actual_word_size);
   if (result != NULL) {
     return result;
   }
@@ -119,9 +113,7 @@
   return NULL;
 }
 
-inline HeapWord* G1AllocRegion::attempt_allocation_force(size_t word_size,
-                                                         bool bot_updates) {
-  assert_alloc_region(bot_updates == _bot_updates, "pre-condition");
+inline HeapWord* G1AllocRegion::attempt_allocation_force(size_t word_size) {
   assert_alloc_region(_alloc_region != NULL, "not initialized properly");
 
   trace("forcing alloc", word_size, word_size);
--- a/src/hotspot/share/gc/g1/g1Allocator.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/gc/g1/g1Allocator.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -190,14 +190,12 @@
 
   HeapWord* result = survivor_gc_alloc_region(context)->attempt_allocation(min_word_size,
                                                                            desired_word_size,
-                                                                           actual_word_size,
-                                                                           false /* bot_updates */);
+                                                                           actual_word_size);
   if (result == NULL && !survivor_is_full(context)) {
     MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
     result = survivor_gc_alloc_region(context)->attempt_allocation_locked(min_word_size,
                                                                           desired_word_size,
-                                                                          actual_word_size,
-                                                                          false /* bot_updates */);
+                                                                          actual_word_size);
     if (result == NULL) {
       set_survivor_full(context);
     }
@@ -217,14 +215,12 @@
 
   HeapWord* result = old_gc_alloc_region(context)->attempt_allocation(min_word_size,
                                                                       desired_word_size,
-                                                                      actual_word_size,
-                                                                      true /* bot_updates */);
+                                                                      actual_word_size);
   if (result == NULL && !old_is_full(context)) {
     MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
     result = old_gc_alloc_region(context)->attempt_allocation_locked(min_word_size,
                                                                      desired_word_size,
-                                                                     actual_word_size,
-                                                                     true /* bot_updates */);
+                                                                     actual_word_size);
     if (result == NULL) {
       set_old_full(context);
     }
--- a/src/hotspot/share/gc/g1/g1Allocator.inline.hpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/gc/g1/g1Allocator.inline.hpp	Thu Jan 11 10:45:44 2018 +0100
@@ -30,18 +30,18 @@
 #include "gc/shared/plab.inline.hpp"
 
 HeapWord* G1Allocator::attempt_allocation(size_t word_size, AllocationContext_t context) {
-  return mutator_alloc_region(context)->attempt_allocation(word_size, false /* bot_updates */);
+  return mutator_alloc_region(context)->attempt_allocation(word_size);
 }
 
 HeapWord* G1Allocator::attempt_allocation_locked(size_t word_size, AllocationContext_t context) {
-  HeapWord* result = mutator_alloc_region(context)->attempt_allocation_locked(word_size, false /* bot_updates */);
+  HeapWord* result = mutator_alloc_region(context)->attempt_allocation_locked(word_size);
   assert(result != NULL || mutator_alloc_region(context)->get() == NULL,
          "Must not have a mutator alloc region if there is no memory, but is " PTR_FORMAT, p2i(mutator_alloc_region(context)->get()));
   return result;
 }
 
 HeapWord* G1Allocator::attempt_allocation_force(size_t word_size, AllocationContext_t context) {
-  return mutator_alloc_region(context)->attempt_allocation_force(word_size, false /* bot_updates */);
+  return mutator_alloc_region(context)->attempt_allocation_force(word_size);
 }
 
 inline HeapWord* G1PLABAllocator::plab_allocate(InCSetState dest,
--- a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -600,6 +600,9 @@
 
   if (!compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
     oop stubName = HotSpotCompiledCode::name(compiled_code_obj);
+    if (oopDesc::is_null(stubName)) {
+      JVMCI_ERROR_OK("stub should have a name");
+    }
     char* name = strdup(java_lang_String::as_utf8_string(stubName));
     cb = RuntimeStub::new_runtime_stub(name,
                                        &buffer,
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -761,6 +761,10 @@
 
 C2V_VMENTRY(jboolean, isCompilable,(JNIEnv *, jobject, jobject jvmci_method))
   methodHandle method = CompilerToVM::asMethod(jvmci_method);
+  // Skip redefined methods
+  if (method->is_old()) {
+    return false;
+  }
   return !method->is_not_compilable(CompLevel_full_optimization);
 C2V_END
 
--- a/src/hotspot/share/memory/metaspace.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/memory/metaspace.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -3695,7 +3695,6 @@
   MaxMetaspaceExpansion = align_down_bounded(MaxMetaspaceExpansion, _commit_alignment);
 
   CompressedClassSpaceSize = align_down_bounded(CompressedClassSpaceSize, _reserve_alignment);
-  set_compressed_class_space_size(CompressedClassSpaceSize);
 
   // Initial virtual space size will be calculated at global_initialize()
   size_t min_metaspace_sz =
@@ -3714,6 +3713,7 @@
                   min_metaspace_sz);
   }
 
+  set_compressed_class_space_size(CompressedClassSpaceSize);
 }
 
 void Metaspace::global_initialize() {
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -1627,14 +1627,16 @@
           log_trace(cds)("Shared spaces preloaded: %s", klass->external_name());
         }
 
-        InstanceKlass* ik = InstanceKlass::cast(klass);
+        if (klass->is_instance_klass()) {
+          InstanceKlass* ik = InstanceKlass::cast(klass);
 
-        // Link the class to cause the bytecodes to be rewritten and the
-        // cpcache to be created. The linking is done as soon as classes
-        // are loaded in order that the related data structures (klass and
-        // cpCache) are located together.
-        try_link_class(ik, THREAD);
-        guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class");
+          // Link the class to cause the bytecodes to be rewritten and the
+          // cpcache to be created. The linking is done as soon as classes
+          // are loaded in order that the related data structures (klass and
+          // cpCache) are located together.
+          try_link_class(ik, THREAD);
+          guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class");
+        }
 
         class_count++;
       }
--- a/src/hotspot/share/opto/compile.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/opto/compile.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -1099,6 +1099,7 @@
   _major_progress = true; // start out assuming good things will happen
   set_has_unsafe_access(false);
   set_max_vector_size(0);
+  set_clear_upper_avx(false);  //false as default for clear upper bits of ymm registers
   Copy::zero_to_bytes(_trap_hist, sizeof(_trap_hist));
   set_decompile_count(0);
 
--- a/src/hotspot/share/opto/compile.hpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/opto/compile.hpp	Thu Jan 11 10:45:44 2018 +0100
@@ -380,7 +380,8 @@
   bool                  _has_stringbuilder;     // True StringBuffers or StringBuilders are allocated
   bool                  _has_boxed_value;       // True if a boxed object is allocated
   bool                  _has_reserved_stack_access; // True if the method or an inlined method is annotated with ReservedStackAccess
-  int                   _max_vector_size;       // Maximum size of generated vectors
+  uint                  _max_vector_size;       // Maximum size of generated vectors
+  bool                  _clear_upper_avx;       // Clear upper bits of ymm registers using vzeroupper
   uint                  _trap_hist[trapHistLength];  // Cumulative traps
   bool                  _trap_can_recompile;    // Have we emitted a recompiling trap?
   uint                  _decompile_count;       // Cumulative decompilation counts.
@@ -659,8 +660,10 @@
   void          set_has_boxed_value(bool z)     { _has_boxed_value = z; }
   bool              has_reserved_stack_access() const { return _has_reserved_stack_access; }
   void          set_has_reserved_stack_access(bool z) { _has_reserved_stack_access = z; }
-  int               max_vector_size() const     { return _max_vector_size; }
-  void          set_max_vector_size(int s)      { _max_vector_size = s; }
+  uint              max_vector_size() const     { return _max_vector_size; }
+  void          set_max_vector_size(uint s)     { _max_vector_size = s; }
+  bool              clear_upper_avx() const     { return _clear_upper_avx; }
+  void          set_clear_upper_avx(bool s)     { _clear_upper_avx = s; }
   void          set_trap_count(uint r, uint c)  { assert(r < trapHistLength, "oob");        _trap_hist[r] = c; }
   uint              trap_count(uint r) const    { assert(r < trapHistLength, "oob"); return _trap_hist[r]; }
   bool              trap_can_recompile() const  { return _trap_can_recompile; }
--- a/src/hotspot/share/opto/library_call.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/opto/library_call.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -343,6 +343,13 @@
 
   bool inline_profileBoolean();
   bool inline_isCompileConstant();
+  void clear_upper_avx() {
+#ifdef X86
+    if (UseAVX >= 2) {
+      C->set_clear_upper_avx(true);
+    }
+#endif
+  }
 };
 
 //---------------------------make_vm_intrinsic----------------------------
@@ -1097,6 +1104,7 @@
 
   // All these intrinsics have checks.
   C->set_has_split_ifs(true); // Has chance for split-if optimization
+  clear_upper_avx();
 
   return _gvn.transform(result);
 }
@@ -1171,6 +1179,8 @@
 
   const TypeAryPtr* mtype = (ae == StrIntrinsicNode::UU) ? TypeAryPtr::CHARS : TypeAryPtr::BYTES;
   set_result(_gvn.transform(new AryEqNode(control(), memory(mtype), arg1, arg2, ae)));
+  clear_upper_avx();
+
   return true;
 }
 
@@ -1242,6 +1252,7 @@
   result = _gvn.transform(result);
   set_result(result);
   replace_in_map(index, result);
+  clear_upper_avx();
   return true;
 }
 
@@ -1340,6 +1351,7 @@
   set_control(_gvn.transform(region));
   record_for_igvn(region);
   set_result(_gvn.transform(phi));
+  clear_upper_avx();
 
   return true;
 }
@@ -1503,6 +1515,8 @@
   if (compress) {
     set_result(_gvn.transform(count));
   }
+  clear_upper_avx();
+
   return true;
 }
 
@@ -1600,6 +1614,8 @@
   if (!stopped()) {
     set_result(newcopy);
   }
+  clear_upper_avx();
+
   return true;
 }
 
@@ -1804,10 +1820,19 @@
     return StubRoutines::dexp() != NULL ?
       runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dexp(),  "dexp") :
       runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dexp),  "EXP");
-  case vmIntrinsics::_dpow:
-    return StubRoutines::dpow() != NULL ?
-      runtime_math(OptoRuntime::Math_DD_D_Type(), StubRoutines::dpow(), "dpow") :
+  case vmIntrinsics::_dpow: {
+    Node* exp = round_double_node(argument(2));
+    const TypeD* d = _gvn.type(exp)->isa_double_constant();
+    if (d != NULL && d->getd() == 2.0) {
+      // Special case: pow(x, 2.0) => x * x
+      Node* base = round_double_node(argument(0));
+      set_result(_gvn.transform(new MulDNode(base, base)));
+      return true;
+    }
+    return StubRoutines::dexp() != NULL ?
+      runtime_math(OptoRuntime::Math_DD_D_Type(), StubRoutines::dpow(),  "dpow") :
       runtime_math(OptoRuntime::Math_DD_D_Type(), FN_PTR(SharedRuntime::dpow),  "POW");
+  }
 #undef FN_PTR
 
    // These intrinsics are not yet correctly implemented
@@ -5330,6 +5355,8 @@
     assert(validated, "shouldn't transform if all arguments not validated");
     set_all_memory(n);
   }
+  clear_upper_avx();
+
 
   return true;
 }
@@ -5450,6 +5477,8 @@
   Node* res_mem = _gvn.transform(new SCMemProjNode(enc));
   set_memory(res_mem, mtype);
   set_result(enc);
+  clear_upper_avx();
+
   return true;
 }
 
--- a/src/hotspot/share/opto/superword.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/opto/superword.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -2442,7 +2442,9 @@
     }
   }//for (int i = 0; i < _block.length(); i++)
 
-  C->set_max_vector_size(max_vlen_in_bytes);
+  if (max_vlen_in_bytes > C->max_vector_size()) {
+    C->set_max_vector_size(max_vlen_in_bytes);
+  }
   if (max_vlen_in_bytes > 0) {
     cl->mark_loop_vectorized();
   }
--- a/src/hotspot/share/prims/jniCheck.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/prims/jniCheck.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -826,7 +826,10 @@
     }
     jint result = UNCHECKED()->EnsureLocalCapacity(env, capacity);
     if (result == JNI_OK) {
-      add_planned_handle_capacity(thr->active_handles(), capacity);
+      // increase local ref capacity if needed
+      if ((size_t)capacity > thr->active_handles()->get_planned_capacity()) {
+        add_planned_handle_capacity(thr->active_handles(), capacity);
+      }
     }
     functionExit(thr);
     return result;
--- a/src/hotspot/share/runtime/arguments.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/runtime/arguments.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -497,7 +497,7 @@
   { "MaxRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
   { "MinRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
   { "InitialRAMFraction",           JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
-  { "UseMembar",                    JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
+  { "UseMembar",                    JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
   { "FastTLABRefill",               JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "SafepointSpinBeforeYield",     JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "DeferThrSuspendLoopCount",     JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
--- a/src/hotspot/share/runtime/compilationPolicy.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/runtime/compilationPolicy.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -470,8 +470,12 @@
       if (bci != InvocationEntryBci) {
         MethodData* mdo = m->method_data();
         if (mdo != NULL) {
-          int count = mdo->bci_to_data(branch_bci)->as_JumpData()->taken();
-          tty->print_cr("back branch count = %d", count);
+          ProfileData *pd = mdo->bci_to_data(branch_bci);
+          if (pd == NULL) {
+            tty->print_cr("back branch count = N/A (missing ProfileData)");
+          } else {
+            tty->print_cr("back branch count = %d", pd->as_JumpData()->taken());
+          }
         }
       }
     }
--- a/src/hotspot/share/runtime/java.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/runtime/java.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -357,7 +357,7 @@
     MemTracker::final_report(tty);
   }
 
-  ThreadsSMRSupport::log_smr_statistics();
+  ThreadsSMRSupport::log_statistics();
 }
 
 #else // PRODUCT MODE STATISTICS
@@ -399,7 +399,7 @@
     Method::print_touched_methods(tty);
   }
 
-  ThreadsSMRSupport::log_smr_statistics();
+  ThreadsSMRSupport::log_statistics();
 }
 
 #endif
--- a/src/hotspot/share/runtime/thread.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/runtime/thread.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -3001,8 +3001,9 @@
     if (ct->env() != NULL) {
       ct->env()->metadata_do(f);
     }
-    if (ct->task() != NULL) {
-      ct->task()->metadata_do(f);
+    CompileTask* task = ct->task();
+    if (task != NULL) {
+      task->metadata_do(f);
     }
   }
 }
@@ -3056,10 +3057,10 @@
   _safepoint_state->print_on(st);
 #endif // PRODUCT
   if (is_Compiler_thread()) {
-    CompilerThread* ct = (CompilerThread*)this;
-    if (ct->task() != NULL) {
+    CompileTask *task = ((CompilerThread*)this)->task();
+    if (task != NULL) {
       st->print("   Compiling: ");
-      ct->task()->print(st, NULL, true, false);
+      task->print(st, NULL, true, false);
     } else {
       st->print("   No compile task");
     }
@@ -3528,7 +3529,7 @@
              X = (JavaThread*)prefetch_and_load_ptr((void**)MACRO_current_p, (intx)MACRO_scan_interval))
 
 // All JavaThreads
-#define ALL_JAVA_THREADS(X) DO_JAVA_THREADS(ThreadsSMRSupport::get_smr_java_thread_list(), X)
+#define ALL_JAVA_THREADS(X) DO_JAVA_THREADS(ThreadsSMRSupport::get_java_thread_list(), X)
 
 // All JavaThreads + all non-JavaThreads (i.e., every thread in the system)
 void Threads::threads_do(ThreadClosure* tc) {
@@ -4437,7 +4438,7 @@
   // that we do not remove thread without safepoint code notice
   { MutexLocker ml(Threads_lock);
 
-    assert(ThreadsSMRSupport::get_smr_java_thread_list()->includes(p), "p must be present");
+    assert(ThreadsSMRSupport::get_java_thread_list()->includes(p), "p must be present");
 
     // Maintain fast thread list
     ThreadsSMRSupport::remove_thread(p);
@@ -4665,7 +4666,7 @@
   }
 #endif // INCLUDE_SERVICES
 
-  ThreadsSMRSupport::print_smr_info_on(st);
+  ThreadsSMRSupport::print_info_on(st);
   st->cr();
 
   ALL_JAVA_THREADS(p) {
@@ -4734,7 +4735,7 @@
 // memory (even in resource area), it might deadlock the error handler.
 void Threads::print_on_error(outputStream* st, Thread* current, char* buf,
                              int buflen) {
-  ThreadsSMRSupport::print_smr_info_on(st);
+  ThreadsSMRSupport::print_info_on(st);
   st->cr();
 
   bool found_current = false;
@@ -4767,9 +4768,15 @@
   ALL_JAVA_THREADS(thread) {
     if (thread->is_Compiler_thread()) {
       CompilerThread* ct = (CompilerThread*) thread;
-      if (ct->task() != NULL) {
+
+      // Keep task in local variable for NULL check.
+      // ct->_task might be set to NULL by concurring compiler thread
+      // because it completed the compilation. The task is never freed,
+      // though, just returned to a free list.
+      CompileTask* task = ct->task();
+      if (task != NULL) {
         thread->print_name_on_error(st, buf, buflen);
-        ct->task()->print(st, NULL, true, true);
+        task->print(st, NULL, true, true);
       }
     }
   }
--- a/src/hotspot/share/runtime/thread.hpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/runtime/thread.hpp	Thu Jan 11 10:45:44 2018 +0100
@@ -2128,13 +2128,13 @@
  private:
   CompilerCounters* _counters;
 
-  ciEnv*            _env;
-  CompileLog*       _log;
-  CompileTask*      _task;
-  CompileQueue*     _queue;
-  BufferBlob*       _buffer_blob;
+  ciEnv*                _env;
+  CompileLog*           _log;
+  CompileTask* volatile _task;  // print_threads_compiling can read this concurrently.
+  CompileQueue*         _queue;
+  BufferBlob*           _buffer_blob;
 
-  AbstractCompiler* _compiler;
+  AbstractCompiler*     _compiler;
 
  public:
 
--- a/src/hotspot/share/runtime/threadSMR.cpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/runtime/threadSMR.cpp	Thu Jan 11 10:45:44 2018 +0100
@@ -31,131 +31,131 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/resourceHash.hpp"
 
-Monitor*              ThreadsSMRSupport::_smr_delete_lock =
-                          new Monitor(Monitor::special, "smr_delete_lock",
+Monitor*              ThreadsSMRSupport::_delete_lock =
+                          new Monitor(Monitor::special, "Thread_SMR_delete_lock",
                                       false /* allow_vm_block */,
                                       Monitor::_safepoint_check_never);
 // The '_cnt', '_max' and '_times" fields are enabled via
 // -XX:+EnableThreadSMRStatistics:
 
-// # of parallel threads in _smr_delete_lock->wait().
+// # of parallel threads in _delete_lock->wait().
 // Impl note: Hard to imagine > 64K waiting threads so this could be 16-bit,
 // but there is no nice 16-bit _FORMAT support.
-uint                  ThreadsSMRSupport::_smr_delete_lock_wait_cnt = 0;
+uint                  ThreadsSMRSupport::_delete_lock_wait_cnt = 0;
 
-// Max # of parallel threads in _smr_delete_lock->wait().
-// Impl note: See _smr_delete_lock_wait_cnt note.
-uint                  ThreadsSMRSupport::_smr_delete_lock_wait_max = 0;
+// Max # of parallel threads in _delete_lock->wait().
+// Impl note: See _delete_lock_wait_cnt note.
+uint                  ThreadsSMRSupport::_delete_lock_wait_max = 0;
 
-// Flag to indicate when an _smr_delete_lock->notify() is needed.
-// Impl note: See _smr_delete_lock_wait_cnt note.
-volatile uint         ThreadsSMRSupport::_smr_delete_notify = 0;
+// Flag to indicate when an _delete_lock->notify() is needed.
+// Impl note: See _delete_lock_wait_cnt note.
+volatile uint         ThreadsSMRSupport::_delete_notify = 0;
 
 // # of threads deleted over VM lifetime.
 // Impl note: Atomically incremented over VM lifetime so use unsigned for more
 // range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc
 // isn't available everywhere (or is it?).
-volatile uint         ThreadsSMRSupport::_smr_deleted_thread_cnt = 0;
+volatile uint         ThreadsSMRSupport::_deleted_thread_cnt = 0;
 
 // Max time in millis to delete a thread.
 // Impl note: 16-bit might be too small on an overloaded machine. Use
 // unsigned since this is a time value. Set via Atomic::cmpxchg() in a
 // loop for correctness.
-volatile uint         ThreadsSMRSupport::_smr_deleted_thread_time_max = 0;
+volatile uint         ThreadsSMRSupport::_deleted_thread_time_max = 0;
 
 // Cumulative time in millis to delete threads.
 // Impl note: Atomically added to over VM lifetime so use unsigned for more
 // range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc
 // isn't available everywhere (or is it?).
-volatile uint         ThreadsSMRSupport::_smr_deleted_thread_times = 0;
+volatile uint         ThreadsSMRSupport::_deleted_thread_times = 0;
 
-ThreadsList* volatile ThreadsSMRSupport::_smr_java_thread_list = new ThreadsList(0);
+ThreadsList* volatile ThreadsSMRSupport::_java_thread_list = new ThreadsList(0);
 
 // # of ThreadsLists allocated over VM lifetime.
 // Impl note: We allocate a new ThreadsList for every thread create and
 // every thread delete so we need a bigger type than the
-// _smr_deleted_thread_cnt field.
-uint64_t              ThreadsSMRSupport::_smr_java_thread_list_alloc_cnt = 1;
+// _deleted_thread_cnt field.
+uint64_t              ThreadsSMRSupport::_java_thread_list_alloc_cnt = 1;
 
 // # of ThreadsLists freed over VM lifetime.
-// Impl note: See _smr_java_thread_list_alloc_cnt note.
-uint64_t              ThreadsSMRSupport::_smr_java_thread_list_free_cnt = 0;
+// Impl note: See _java_thread_list_alloc_cnt note.
+uint64_t              ThreadsSMRSupport::_java_thread_list_free_cnt = 0;
 
 // Max size ThreadsList allocated.
 // Impl note: Max # of threads alive at one time should fit in unsigned 32-bit.
-uint                  ThreadsSMRSupport::_smr_java_thread_list_max = 0;
+uint                  ThreadsSMRSupport::_java_thread_list_max = 0;
 
 // Max # of nested ThreadsLists for a thread.
 // Impl note: Hard to imagine > 64K nested ThreadsLists so this could be
 // 16-bit, but there is no nice 16-bit _FORMAT support.
-uint                  ThreadsSMRSupport::_smr_nested_thread_list_max = 0;
+uint                  ThreadsSMRSupport::_nested_thread_list_max = 0;
 
 // # of ThreadsListHandles deleted over VM lifetime.
 // Impl note: Atomically incremented over VM lifetime so use unsigned for
 // more range. There will be fewer ThreadsListHandles than threads so
 // unsigned 32-bit should be fine.
-volatile uint         ThreadsSMRSupport::_smr_tlh_cnt = 0;
+volatile uint         ThreadsSMRSupport::_tlh_cnt = 0;
 
 // Max time in millis to delete a ThreadsListHandle.
 // Impl note: 16-bit might be too small on an overloaded machine. Use
 // unsigned since this is a time value. Set via Atomic::cmpxchg() in a
 // loop for correctness.
-volatile uint         ThreadsSMRSupport::_smr_tlh_time_max = 0;
+volatile uint         ThreadsSMRSupport::_tlh_time_max = 0;
 
 // Cumulative time in millis to delete ThreadsListHandles.
 // Impl note: Atomically added to over VM lifetime so use unsigned for more
 // range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc
 // isn't available everywhere (or is it?).
-volatile uint         ThreadsSMRSupport::_smr_tlh_times = 0;
+volatile uint         ThreadsSMRSupport::_tlh_times = 0;
 
-ThreadsList*          ThreadsSMRSupport::_smr_to_delete_list = NULL;
+ThreadsList*          ThreadsSMRSupport::_to_delete_list = NULL;
 
 // # of parallel ThreadsLists on the to-delete list.
 // Impl note: Hard to imagine > 64K ThreadsLists needing to be deleted so
 // this could be 16-bit, but there is no nice 16-bit _FORMAT support.
-uint                  ThreadsSMRSupport::_smr_to_delete_list_cnt = 0;
+uint                  ThreadsSMRSupport::_to_delete_list_cnt = 0;
 
 // Max # of parallel ThreadsLists on the to-delete list.
-// Impl note: See _smr_to_delete_list_cnt note.
-uint                  ThreadsSMRSupport::_smr_to_delete_list_max = 0;
+// Impl note: See _to_delete_list_cnt note.
+uint                  ThreadsSMRSupport::_to_delete_list_max = 0;
 
 
 // 'inline' functions first so the definitions are before first use:
 
-inline void ThreadsSMRSupport::add_smr_deleted_thread_times(uint add_value) {
-  Atomic::add(add_value, &_smr_deleted_thread_times);
+inline void ThreadsSMRSupport::add_deleted_thread_times(uint add_value) {
+  Atomic::add(add_value, &_deleted_thread_times);
 }
 
-inline void ThreadsSMRSupport::inc_smr_deleted_thread_cnt() {
-  Atomic::inc(&_smr_deleted_thread_cnt);
+inline void ThreadsSMRSupport::inc_deleted_thread_cnt() {
+  Atomic::inc(&_deleted_thread_cnt);
 }
 
-inline void ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt() {
-  _smr_java_thread_list_alloc_cnt++;
+inline void ThreadsSMRSupport::inc_java_thread_list_alloc_cnt() {
+  _java_thread_list_alloc_cnt++;
 }
 
-inline void ThreadsSMRSupport::update_smr_deleted_thread_time_max(uint new_value) {
+inline void ThreadsSMRSupport::update_deleted_thread_time_max(uint new_value) {
   while (true) {
-    uint cur_value = _smr_deleted_thread_time_max;
+    uint cur_value = _deleted_thread_time_max;
     if (new_value <= cur_value) {
       // No need to update max value so we're done.
       break;
     }
-    if (Atomic::cmpxchg(new_value, &_smr_deleted_thread_time_max, cur_value) == cur_value) {
+    if (Atomic::cmpxchg(new_value, &_deleted_thread_time_max, cur_value) == cur_value) {
       // Updated max value so we're done. Otherwise try it all again.
       break;
     }
   }
 }
 
-inline void ThreadsSMRSupport::update_smr_java_thread_list_max(uint new_value) {
-  if (new_value > _smr_java_thread_list_max) {
-    _smr_java_thread_list_max = new_value;
+inline void ThreadsSMRSupport::update_java_thread_list_max(uint new_value) {
+  if (new_value > _java_thread_list_max) {
+    _java_thread_list_max = new_value;
   }
 }
 
-inline ThreadsList* ThreadsSMRSupport::xchg_smr_java_thread_list(ThreadsList* new_list) {
-  return (ThreadsList*)Atomic::xchg(new_list, &_smr_java_thread_list);
+inline ThreadsList* ThreadsSMRSupport::xchg_java_thread_list(ThreadsList* new_list) {
+  return (ThreadsList*)Atomic::xchg(new_list, &_java_thread_list);
 }
 
 
@@ -268,7 +268,7 @@
     }
 
     // The current JavaThread has a hazard ptr (ThreadsList reference)
-    // which might be _smr_java_thread_list or it might be an older
+    // which might be _java_thread_list or it might be an older
     // ThreadsList that has been removed but not freed. In either case,
     // the hazard ptr is protecting all the JavaThreads on that
     // ThreadsList.
@@ -347,7 +347,7 @@
     if (Thread::is_hazard_ptr_tagged(current_list)) return;
 
     // The current JavaThread has a hazard ptr (ThreadsList reference)
-    // which might be _smr_java_thread_list or it might be an older
+    // which might be _java_thread_list or it might be an older
     // ThreadsList that has been removed but not freed. In either case,
     // the hazard ptr is protecting all the JavaThreads on that
     // ThreadsList, but we only care about matching a specific JavaThread.
@@ -476,7 +476,7 @@
   if (EnableThreadSMRStatistics) {
     _timer.stop();
     uint millis = (uint)_timer.milliseconds();
-    ThreadsSMRSupport::update_smr_tlh_stats(millis);
+    ThreadsSMRSupport::update_tlh_stats(millis);
   }
 }
 
@@ -574,12 +574,12 @@
   ThreadsList* threads;
 
   // Stable recording of a hazard ptr for SMR. This code does not use
-  // locks so its use of the _smr_java_thread_list & _threads_hazard_ptr
+  // locks so its use of the _java_thread_list & _threads_hazard_ptr
   // fields is racy relative to code that uses those fields with locks.
   // OrderAccess and Atomic functions are used to deal with those races.
   //
   while (true) {
-    threads = get_smr_java_thread_list();
+    threads = get_java_thread_list();
 
     // Publish a tagged hazard ptr to denote that the hazard ptr is not
     // yet verified as being stable. Due to the fence after the hazard
@@ -590,9 +590,9 @@
     ThreadsList* unverified_threads = Thread::tag_hazard_ptr(threads);
     self->set_threads_hazard_ptr(unverified_threads);
 
-    // If _smr_java_thread_list has changed, we have lost a race with
+    // If _java_thread_list has changed, we have lost a race with
     // Threads::add() or Threads::remove() and have to try again.
-    if (get_smr_java_thread_list() != threads) {
+    if (get_java_thread_list() != threads) {
       continue;
     }
 
@@ -634,15 +634,15 @@
   {
     // Only grab the Threads_lock if we don't already own it.
     MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock);
-    node = new NestedThreadsList(get_smr_java_thread_list());
+    node = new NestedThreadsList(get_java_thread_list());
     // We insert at the front of the list to match up with the delete
     // in release_stable_list().
     node->set_next(self->get_nested_threads_hazard_ptr());
     self->set_nested_threads_hazard_ptr(node);
     if (EnableThreadSMRStatistics) {
       self->inc_nested_threads_hazard_ptr_cnt();
-      if (self->nested_threads_hazard_ptr_cnt() > _smr_nested_thread_list_max) {
-        _smr_nested_thread_list_max = self->nested_threads_hazard_ptr_cnt();
+      if (self->nested_threads_hazard_ptr_cnt() > _nested_thread_list_max) {
+        _nested_thread_list_max = self->nested_threads_hazard_ptr_cnt();
       }
     }
   }
@@ -652,25 +652,101 @@
 }
 
 void ThreadsSMRSupport::add_thread(JavaThread *thread){
-  ThreadsList *new_list = ThreadsList::add_thread(ThreadsSMRSupport::get_smr_java_thread_list(), thread);
+  ThreadsList *new_list = ThreadsList::add_thread(ThreadsSMRSupport::get_java_thread_list(), thread);
   if (EnableThreadSMRStatistics) {
-    ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt();
-    ThreadsSMRSupport::update_smr_java_thread_list_max(new_list->length());
+    ThreadsSMRSupport::inc_java_thread_list_alloc_cnt();
+    ThreadsSMRSupport::update_java_thread_list_max(new_list->length());
   }
-  // Initial _smr_java_thread_list will not generate a "Threads::add" mesg.
+  // Initial _java_thread_list will not generate a "Threads::add" mesg.
   log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::add: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list));
 
-  ThreadsList *old_list = ThreadsSMRSupport::xchg_smr_java_thread_list(new_list);
-  ThreadsSMRSupport::smr_free_list(old_list);
+  ThreadsList *old_list = ThreadsSMRSupport::xchg_java_thread_list(new_list);
+  ThreadsSMRSupport::free_list(old_list);
 }
 
-// set_smr_delete_notify() and clear_smr_delete_notify() are called
-// under the protection of the smr_delete_lock, but we also use an
+// set_delete_notify() and clear_delete_notify() are called
+// under the protection of the delete_lock, but we also use an
 // Atomic operation to ensure the memory update is seen earlier than
-// when the smr_delete_lock is dropped.
+// when the delete_lock is dropped.
 //
-void ThreadsSMRSupport::clear_smr_delete_notify() {
-  Atomic::dec(&_smr_delete_notify);
+void ThreadsSMRSupport::clear_delete_notify() {
+  Atomic::dec(&_delete_notify);
+}
+
+bool ThreadsSMRSupport::delete_notify() {
+  // Use load_acquire() in order to see any updates to _delete_notify
+  // earlier than when delete_lock is grabbed.
+  return (OrderAccess::load_acquire(&_delete_notify) != 0);
+}
+
+// Safely free a ThreadsList after a Threads::add() or Threads::remove().
+// The specified ThreadsList may not get deleted during this call if it
+// is still in-use (referenced by a hazard ptr). Other ThreadsLists
+// in the chain may get deleted by this call if they are no longer in-use.
+void ThreadsSMRSupport::free_list(ThreadsList* threads) {
+  assert_locked_or_safepoint(Threads_lock);
+
+  threads->set_next_list(_to_delete_list);
+  _to_delete_list = threads;
+  if (EnableThreadSMRStatistics) {
+    _to_delete_list_cnt++;
+    if (_to_delete_list_cnt > _to_delete_list_max) {
+      _to_delete_list_max = _to_delete_list_cnt;
+    }
+  }
+
+  // Hash table size should be first power of two higher than twice the length of the ThreadsList
+  int hash_table_size = MIN2((int)get_java_thread_list()->length(), 32) << 1;
+  hash_table_size--;
+  hash_table_size |= hash_table_size >> 1;
+  hash_table_size |= hash_table_size >> 2;
+  hash_table_size |= hash_table_size >> 4;
+  hash_table_size |= hash_table_size >> 8;
+  hash_table_size |= hash_table_size >> 16;
+  hash_table_size++;
+
+  // Gather a hash table of the current hazard ptrs:
+  ThreadScanHashtable *scan_table = new ThreadScanHashtable(hash_table_size);
+  ScanHazardPtrGatherThreadsListClosure scan_cl(scan_table);
+  Threads::threads_do(&scan_cl);
+
+  // Walk through the linked list of pending freeable ThreadsLists
+  // and free the ones that are not referenced from hazard ptrs.
+  ThreadsList* current = _to_delete_list;
+  ThreadsList* prev = NULL;
+  ThreadsList* next = NULL;
+  bool threads_is_freed = false;
+  while (current != NULL) {
+    next = current->next_list();
+    if (!scan_table->has_entry((void*)current)) {
+      // This ThreadsList is not referenced by a hazard ptr.
+      if (prev != NULL) {
+        prev->set_next_list(next);
+      }
+      if (_to_delete_list == current) {
+        _to_delete_list = next;
+      }
+
+      log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::free_list: threads=" INTPTR_FORMAT " is freed.", os::current_thread_id(), p2i(current));
+      if (current == threads) threads_is_freed = true;
+      delete current;
+      if (EnableThreadSMRStatistics) {
+        _java_thread_list_free_cnt++;
+        _to_delete_list_cnt--;
+      }
+    } else {
+      prev = current;
+    }
+    current = next;
+  }
+
+  if (!threads_is_freed) {
+    // Only report "is not freed" on the original call to
+    // free_list() for this ThreadsList.
+    log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::free_list: threads=" INTPTR_FORMAT " is not freed.", os::current_thread_id(), p2i(threads));
+  }
+
+  delete scan_table;
 }
 
 // Return true if the specified JavaThread is protected by a hazard
@@ -681,7 +757,7 @@
 
   // Hash table size should be first power of two higher than twice
   // the length of the Threads list.
-  int hash_table_size = MIN2((int)get_smr_java_thread_list()->length(), 32) << 1;
+  int hash_table_size = MIN2((int)get_java_thread_list()->length(), 32) << 1;
   hash_table_size--;
   hash_table_size |= hash_table_size >> 1;
   hash_table_size |= hash_table_size >> 2;
@@ -736,10 +812,10 @@
   self->set_threads_hazard_ptr(NULL);
 
   // We use double-check locking to reduce traffic on the system
-  // wide smr_delete_lock.
-  if (ThreadsSMRSupport::smr_delete_notify()) {
+  // wide Thread-SMR delete_lock.
+  if (ThreadsSMRSupport::delete_notify()) {
     // An exiting thread might be waiting in smr_delete(); we need to
-    // check with smr_delete_lock to be sure.
+    // check with delete_lock to be sure.
     release_stable_list_wake_up((char *) "regular hazard ptr");
   }
 }
@@ -772,7 +848,7 @@
   }
 
   // An exiting thread might be waiting in smr_delete(); we need to
-  // check with smr_delete_lock to be sure.
+  // check with delete_lock to be sure.
   release_stable_list_wake_up((char *) "nested hazard ptr");
 
   log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::release_stable_list: delete NestedThreadsList node containing ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(node->t_list()));
@@ -781,21 +857,21 @@
 }
 
 // Wake up portion of the release stable ThreadsList protocol;
-// uses the smr_delete_lock().
+// uses the delete_lock().
 //
 void ThreadsSMRSupport::release_stable_list_wake_up(char *log_str) {
   assert(log_str != NULL, "sanity check");
 
-  // Note: smr_delete_lock is held in smr_delete() for the entire
+  // Note: delete_lock is held in smr_delete() for the entire
   // hazard ptr search so that we do not lose this notify() if
   // the exiting thread has to wait. That code path also holds
-  // Threads_lock (which was grabbed before smr_delete_lock) so that
+  // Threads_lock (which was grabbed before delete_lock) so that
   // threads_do() can be called. This means the system can't start a
   // safepoint which means this thread can't take too long to get to
-  // a safepoint because of being blocked on smr_delete_lock.
+  // a safepoint because of being blocked on delete_lock.
   //
-  MonitorLockerEx ml(ThreadsSMRSupport::smr_delete_lock(), Monitor::_no_safepoint_check_flag);
-  if (ThreadsSMRSupport::smr_delete_notify()) {
+  MonitorLockerEx ml(ThreadsSMRSupport::delete_lock(), Monitor::_no_safepoint_check_flag);
+  if (ThreadsSMRSupport::delete_notify()) {
     // Notify any exiting JavaThreads that are waiting in smr_delete()
     // that we've released a ThreadsList.
     ml.notify_all();
@@ -804,23 +880,23 @@
 }
 
 void ThreadsSMRSupport::remove_thread(JavaThread *thread) {
-  ThreadsList *new_list = ThreadsList::remove_thread(ThreadsSMRSupport::get_smr_java_thread_list(), thread);
+  ThreadsList *new_list = ThreadsList::remove_thread(ThreadsSMRSupport::get_java_thread_list(), thread);
   if (EnableThreadSMRStatistics) {
-    ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt();
+    ThreadsSMRSupport::inc_java_thread_list_alloc_cnt();
     // This list is smaller so no need to check for a "longest" update.
   }
 
-  // Final _smr_java_thread_list will not generate a "Threads::remove" mesg.
+  // Final _java_thread_list will not generate a "Threads::remove" mesg.
   log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::remove: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list));
 
-  ThreadsList *old_list = ThreadsSMRSupport::xchg_smr_java_thread_list(new_list);
-  ThreadsSMRSupport::smr_free_list(old_list);
+  ThreadsList *old_list = ThreadsSMRSupport::xchg_java_thread_list(new_list);
+  ThreadsSMRSupport::free_list(old_list);
 }
 
-// See note for clear_smr_delete_notify().
+// See note for clear_delete_notify().
 //
-void ThreadsSMRSupport::set_smr_delete_notify() {
-  Atomic::inc(&_smr_delete_notify);
+void ThreadsSMRSupport::set_delete_notify() {
+  Atomic::inc(&_delete_notify);
 }
 
 // Safely delete a JavaThread when it is no longer in use by a
@@ -842,16 +918,16 @@
       MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
       // Cannot use a MonitorLockerEx helper here because we have
       // to drop the Threads_lock first if we wait.
-      ThreadsSMRSupport::smr_delete_lock()->lock_without_safepoint_check();
-      // Set the smr_delete_notify flag after we grab smr_delete_lock
+      ThreadsSMRSupport::delete_lock()->lock_without_safepoint_check();
+      // Set the delete_notify flag after we grab delete_lock
       // and before we scan hazard ptrs because we're doing
       // double-check locking in release_stable_list().
-      ThreadsSMRSupport::set_smr_delete_notify();
+      ThreadsSMRSupport::set_delete_notify();
 
       if (!is_a_protected_JavaThread(thread)) {
         // This is the common case.
-        ThreadsSMRSupport::clear_smr_delete_notify();
-        ThreadsSMRSupport::smr_delete_lock()->unlock();
+        ThreadsSMRSupport::clear_delete_notify();
+        ThreadsSMRSupport::delete_lock()->unlock();
         break;
       }
       if (!has_logged_once) {
@@ -865,22 +941,22 @@
     } // We have to drop the Threads_lock to wait or delete the thread
 
     if (EnableThreadSMRStatistics) {
-      _smr_delete_lock_wait_cnt++;
-      if (_smr_delete_lock_wait_cnt > _smr_delete_lock_wait_max) {
-        _smr_delete_lock_wait_max = _smr_delete_lock_wait_cnt;
+      _delete_lock_wait_cnt++;
+      if (_delete_lock_wait_cnt > _delete_lock_wait_max) {
+        _delete_lock_wait_max = _delete_lock_wait_cnt;
       }
     }
     // Wait for a release_stable_list() call before we check again. No
     // safepoint check, no timeout, and not as suspend equivalent flag
     // because this JavaThread is not on the Threads list.
-    ThreadsSMRSupport::smr_delete_lock()->wait(Mutex::_no_safepoint_check_flag, 0,
+    ThreadsSMRSupport::delete_lock()->wait(Mutex::_no_safepoint_check_flag, 0,
                                      !Mutex::_as_suspend_equivalent_flag);
     if (EnableThreadSMRStatistics) {
-      _smr_delete_lock_wait_cnt--;
+      _delete_lock_wait_cnt--;
     }
 
-    ThreadsSMRSupport::clear_smr_delete_notify();
-    ThreadsSMRSupport::smr_delete_lock()->unlock();
+    ThreadsSMRSupport::clear_delete_notify();
+    ThreadsSMRSupport::delete_lock()->unlock();
     // Retry the whole scenario.
   }
 
@@ -893,166 +969,89 @@
   if (EnableThreadSMRStatistics) {
     timer.stop();
     uint millis = (uint)timer.milliseconds();
-    ThreadsSMRSupport::inc_smr_deleted_thread_cnt();
-    ThreadsSMRSupport::add_smr_deleted_thread_times(millis);
-    ThreadsSMRSupport::update_smr_deleted_thread_time_max(millis);
+    ThreadsSMRSupport::inc_deleted_thread_cnt();
+    ThreadsSMRSupport::add_deleted_thread_times(millis);
+    ThreadsSMRSupport::update_deleted_thread_time_max(millis);
   }
 
   log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_delete: thread=" INTPTR_FORMAT " is deleted.", os::current_thread_id(), p2i(thread));
 }
 
-bool ThreadsSMRSupport::smr_delete_notify() {
-  // Use load_acquire() in order to see any updates to _smr_delete_notify
-  // earlier than when smr_delete_lock is grabbed.
-  return (OrderAccess::load_acquire(&_smr_delete_notify) != 0);
-}
-
-// Safely free a ThreadsList after a Threads::add() or Threads::remove().
-// The specified ThreadsList may not get deleted during this call if it
-// is still in-use (referenced by a hazard ptr). Other ThreadsLists
-// in the chain may get deleted by this call if they are no longer in-use.
-void ThreadsSMRSupport::smr_free_list(ThreadsList* threads) {
-  assert_locked_or_safepoint(Threads_lock);
-
-  threads->set_next_list(_smr_to_delete_list);
-  _smr_to_delete_list = threads;
-  if (EnableThreadSMRStatistics) {
-    _smr_to_delete_list_cnt++;
-    if (_smr_to_delete_list_cnt > _smr_to_delete_list_max) {
-      _smr_to_delete_list_max = _smr_to_delete_list_cnt;
-    }
-  }
-
-  // Hash table size should be first power of two higher than twice the length of the ThreadsList
-  int hash_table_size = MIN2((int)get_smr_java_thread_list()->length(), 32) << 1;
-  hash_table_size--;
-  hash_table_size |= hash_table_size >> 1;
-  hash_table_size |= hash_table_size >> 2;
-  hash_table_size |= hash_table_size >> 4;
-  hash_table_size |= hash_table_size >> 8;
-  hash_table_size |= hash_table_size >> 16;
-  hash_table_size++;
-
-  // Gather a hash table of the current hazard ptrs:
-  ThreadScanHashtable *scan_table = new ThreadScanHashtable(hash_table_size);
-  ScanHazardPtrGatherThreadsListClosure scan_cl(scan_table);
-  Threads::threads_do(&scan_cl);
-
-  // Walk through the linked list of pending freeable ThreadsLists
-  // and free the ones that are not referenced from hazard ptrs.
-  ThreadsList* current = _smr_to_delete_list;
-  ThreadsList* prev = NULL;
-  ThreadsList* next = NULL;
-  bool threads_is_freed = false;
-  while (current != NULL) {
-    next = current->next_list();
-    if (!scan_table->has_entry((void*)current)) {
-      // This ThreadsList is not referenced by a hazard ptr.
-      if (prev != NULL) {
-        prev->set_next_list(next);
-      }
-      if (_smr_to_delete_list == current) {
-        _smr_to_delete_list = next;
-      }
-
-      log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_free_list: threads=" INTPTR_FORMAT " is freed.", os::current_thread_id(), p2i(current));
-      if (current == threads) threads_is_freed = true;
-      delete current;
-      if (EnableThreadSMRStatistics) {
-        _smr_java_thread_list_free_cnt++;
-        _smr_to_delete_list_cnt--;
-      }
-    } else {
-      prev = current;
-    }
-    current = next;
-  }
-
-  if (!threads_is_freed) {
-    // Only report "is not freed" on the original call to
-    // smr_free_list() for this ThreadsList.
-    log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_free_list: threads=" INTPTR_FORMAT " is not freed.", os::current_thread_id(), p2i(threads));
-  }
-
-  delete scan_table;
-}
-
 
 // Debug, logging, and printing stuff at the end:
 
 // Log Threads class SMR info.
-void ThreadsSMRSupport::log_smr_statistics() {
+void ThreadsSMRSupport::log_statistics() {
   LogTarget(Info, thread, smr) log;
   if (log.is_enabled()) {
     LogStream out(log);
-    print_smr_info_on(&out);
+    print_info_on(&out);
   }
 }
 
 // Print Threads class SMR info.
-void ThreadsSMRSupport::print_smr_info_on(outputStream* st) {
+void ThreadsSMRSupport::print_info_on(outputStream* st) {
   // Only grab the Threads_lock if we don't already own it
   // and if we are not reporting an error.
   MutexLockerEx ml((Threads_lock->owned_by_self() || VMError::is_error_reported()) ? NULL : Threads_lock);
 
   st->print_cr("Threads class SMR info:");
-  st->print_cr("_smr_java_thread_list=" INTPTR_FORMAT ", length=%u, "
-               "elements={", p2i(_smr_java_thread_list),
-               _smr_java_thread_list->length());
-  print_smr_info_elements_on(st, _smr_java_thread_list);
+  st->print_cr("_java_thread_list=" INTPTR_FORMAT ", length=%u, "
+               "elements={", p2i(_java_thread_list),
+               _java_thread_list->length());
+  print_info_elements_on(st, _java_thread_list);
   st->print_cr("}");
-  if (_smr_to_delete_list != NULL) {
-    st->print_cr("_smr_to_delete_list=" INTPTR_FORMAT ", length=%u, "
-                 "elements={", p2i(_smr_to_delete_list),
-                 _smr_to_delete_list->length());
-    print_smr_info_elements_on(st, _smr_to_delete_list);
+  if (_to_delete_list != NULL) {
+    st->print_cr("_to_delete_list=" INTPTR_FORMAT ", length=%u, "
+                 "elements={", p2i(_to_delete_list),
+                 _to_delete_list->length());
+    print_info_elements_on(st, _to_delete_list);
     st->print_cr("}");
-    for (ThreadsList *t_list = _smr_to_delete_list->next_list();
+    for (ThreadsList *t_list = _to_delete_list->next_list();
          t_list != NULL; t_list = t_list->next_list()) {
       st->print("next-> " INTPTR_FORMAT ", length=%u, "
                 "elements={", p2i(t_list), t_list->length());
-      print_smr_info_elements_on(st, t_list);
+      print_info_elements_on(st, t_list);
       st->print_cr("}");
     }
   }
   if (!EnableThreadSMRStatistics) {
     return;
   }
-  st->print_cr("_smr_java_thread_list_alloc_cnt=" UINT64_FORMAT ","
-               "_smr_java_thread_list_free_cnt=" UINT64_FORMAT ","
-               "_smr_java_thread_list_max=%u, "
-               "_smr_nested_thread_list_max=%u",
-               _smr_java_thread_list_alloc_cnt,
-               _smr_java_thread_list_free_cnt,
-               _smr_java_thread_list_max,
-               _smr_nested_thread_list_max);
-  if (_smr_tlh_cnt > 0) {
-    st->print_cr("_smr_tlh_cnt=%u"
-                 ", _smr_tlh_times=%u"
-                 ", avg_smr_tlh_time=%0.2f"
-                 ", _smr_tlh_time_max=%u",
-                 _smr_tlh_cnt, _smr_tlh_times,
-                 ((double) _smr_tlh_times / _smr_tlh_cnt),
-                 _smr_tlh_time_max);
+  st->print_cr("_java_thread_list_alloc_cnt=" UINT64_FORMAT ","
+               "_java_thread_list_free_cnt=" UINT64_FORMAT ","
+               "_java_thread_list_max=%u, "
+               "_nested_thread_list_max=%u",
+               _java_thread_list_alloc_cnt,
+               _java_thread_list_free_cnt,
+               _java_thread_list_max,
+               _nested_thread_list_max);
+  if (_tlh_cnt > 0) {
+    st->print_cr("_tlh_cnt=%u"
+                 ", _tlh_times=%u"
+                 ", avg_tlh_time=%0.2f"
+                 ", _tlh_time_max=%u",
+                 _tlh_cnt, _tlh_times,
+                 ((double) _tlh_times / _tlh_cnt),
+                 _tlh_time_max);
   }
-  if (_smr_deleted_thread_cnt > 0) {
-    st->print_cr("_smr_deleted_thread_cnt=%u"
-                 ", _smr_deleted_thread_times=%u"
-                 ", avg_smr_deleted_thread_time=%0.2f"
-                 ", _smr_deleted_thread_time_max=%u",
-                 _smr_deleted_thread_cnt, _smr_deleted_thread_times,
-                 ((double) _smr_deleted_thread_times / _smr_deleted_thread_cnt),
-                 _smr_deleted_thread_time_max);
+  if (_deleted_thread_cnt > 0) {
+    st->print_cr("_deleted_thread_cnt=%u"
+                 ", _deleted_thread_times=%u"
+                 ", avg_deleted_thread_time=%0.2f"
+                 ", _deleted_thread_time_max=%u",
+                 _deleted_thread_cnt, _deleted_thread_times,
+                 ((double) _deleted_thread_times / _deleted_thread_cnt),
+                 _deleted_thread_time_max);
   }
-  st->print_cr("_smr_delete_lock_wait_cnt=%u, _smr_delete_lock_wait_max=%u",
-               _smr_delete_lock_wait_cnt, _smr_delete_lock_wait_max);
-  st->print_cr("_smr_to_delete_list_cnt=%u, _smr_to_delete_list_max=%u",
-               _smr_to_delete_list_cnt, _smr_to_delete_list_max);
+  st->print_cr("_delete_lock_wait_cnt=%u, _delete_lock_wait_max=%u",
+               _delete_lock_wait_cnt, _delete_lock_wait_max);
+  st->print_cr("_to_delete_list_cnt=%u, _to_delete_list_max=%u",
+               _to_delete_list_cnt, _to_delete_list_max);
 }
 
 // Print ThreadsList elements (4 per line).
-void ThreadsSMRSupport::print_smr_info_elements_on(outputStream* st,
-                                         ThreadsList* t_list) {
+void ThreadsSMRSupport::print_info_elements_on(outputStream* st, ThreadsList* t_list) {
   uint cnt = 0;
   JavaThreadIterator jti(t_list);
   for (JavaThread *jt = jti.first(); jt != NULL; jt = jti.next()) {
--- a/src/hotspot/share/runtime/threadSMR.hpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/runtime/threadSMR.hpp	Thu Jan 11 10:45:44 2018 +0100
@@ -81,67 +81,68 @@
 //
 class ThreadsSMRSupport : AllStatic {
   // The coordination between ThreadsSMRSupport::release_stable_list() and
-  // ThreadsSMRSupport::smr_delete() uses the smr_delete_lock in order to
+  // ThreadsSMRSupport::smr_delete() uses the delete_lock in order to
   // reduce the traffic on the Threads_lock.
-  static Monitor*              _smr_delete_lock;
+  static Monitor*              _delete_lock;
   // The '_cnt', '_max' and '_times" fields are enabled via
   // -XX:+EnableThreadSMRStatistics (see thread.cpp for a
   // description about each field):
-  static uint                  _smr_delete_lock_wait_cnt;
-  static uint                  _smr_delete_lock_wait_max;
-  // The smr_delete_notify flag is used for proper double-check
-  // locking in order to reduce the traffic on the smr_delete_lock.
-  static volatile uint         _smr_delete_notify;
-  static volatile uint         _smr_deleted_thread_cnt;
-  static volatile uint         _smr_deleted_thread_time_max;
-  static volatile uint         _smr_deleted_thread_times;
-  static ThreadsList* volatile _smr_java_thread_list;
-  static uint64_t              _smr_java_thread_list_alloc_cnt;
-  static uint64_t              _smr_java_thread_list_free_cnt;
-  static uint                  _smr_java_thread_list_max;
-  static uint                  _smr_nested_thread_list_max;
-  static volatile uint         _smr_tlh_cnt;
-  static volatile uint         _smr_tlh_time_max;
-  static volatile uint         _smr_tlh_times;
-  static ThreadsList*          _smr_to_delete_list;
-  static uint                  _smr_to_delete_list_cnt;
-  static uint                  _smr_to_delete_list_max;
+  static uint                  _delete_lock_wait_cnt;
+  static uint                  _delete_lock_wait_max;
+  // The delete_notify flag is used for proper double-check
+  // locking in order to reduce the traffic on the system wide
+  // Thread-SMR delete_lock.
+  static volatile uint         _delete_notify;
+  static volatile uint         _deleted_thread_cnt;
+  static volatile uint         _deleted_thread_time_max;
+  static volatile uint         _deleted_thread_times;
+  static ThreadsList* volatile _java_thread_list;
+  static uint64_t              _java_thread_list_alloc_cnt;
+  static uint64_t              _java_thread_list_free_cnt;
+  static uint                  _java_thread_list_max;
+  static uint                  _nested_thread_list_max;
+  static volatile uint         _tlh_cnt;
+  static volatile uint         _tlh_time_max;
+  static volatile uint         _tlh_times;
+  static ThreadsList*          _to_delete_list;
+  static uint                  _to_delete_list_cnt;
+  static uint                  _to_delete_list_max;
 
   static ThreadsList *acquire_stable_list_fast_path(Thread *self);
   static ThreadsList *acquire_stable_list_nested_path(Thread *self);
-  static void add_smr_deleted_thread_times(uint add_value);
-  static void add_smr_tlh_times(uint add_value);
-  static void clear_smr_delete_notify();
-  static void inc_smr_deleted_thread_cnt();
-  static void inc_smr_java_thread_list_alloc_cnt();
-  static void inc_smr_tlh_cnt();
+  static void add_deleted_thread_times(uint add_value);
+  static void add_tlh_times(uint add_value);
+  static void clear_delete_notify();
+  static Monitor* delete_lock() { return _delete_lock; }
+  static bool delete_notify();
+  static void free_list(ThreadsList* threads);
+  static void inc_deleted_thread_cnt();
+  static void inc_java_thread_list_alloc_cnt();
+  static void inc_tlh_cnt();
   static bool is_a_protected_JavaThread(JavaThread *thread);
   static void release_stable_list_fast_path(Thread *self);
   static void release_stable_list_nested_path(Thread *self);
   static void release_stable_list_wake_up(char *log_str);
-  static void set_smr_delete_notify();
-  static Monitor* smr_delete_lock() { return _smr_delete_lock; }
-  static bool smr_delete_notify();
-  static void smr_free_list(ThreadsList* threads);
-  static void update_smr_deleted_thread_time_max(uint new_value);
-  static void update_smr_java_thread_list_max(uint new_value);
-  static void update_smr_tlh_time_max(uint new_value);
-  static ThreadsList* xchg_smr_java_thread_list(ThreadsList* new_list);
+  static void set_delete_notify();
+  static void update_deleted_thread_time_max(uint new_value);
+  static void update_java_thread_list_max(uint new_value);
+  static void update_tlh_time_max(uint new_value);
+  static ThreadsList* xchg_java_thread_list(ThreadsList* new_list);
 
  public:
   static ThreadsList *acquire_stable_list(Thread *self, bool is_ThreadsListSetter);
   static void add_thread(JavaThread *thread);
-  static ThreadsList* get_smr_java_thread_list();
+  static ThreadsList* get_java_thread_list();
   static bool is_a_protected_JavaThread_with_lock(JavaThread *thread);
   static void release_stable_list(Thread *self);
   static void remove_thread(JavaThread *thread);
   static void smr_delete(JavaThread *thread);
-  static void update_smr_tlh_stats(uint millis);
+  static void update_tlh_stats(uint millis);
 
   // Logging and printing support:
-  static void log_smr_statistics();
-  static void print_smr_info_elements_on(outputStream* st, ThreadsList* t_list);
-  static void print_smr_info_on(outputStream* st);
+  static void log_statistics();
+  static void print_info_elements_on(outputStream* st, ThreadsList* t_list);
+  static void print_info_on(outputStream* st);
 };
 
 // A fast list of JavaThreads.
--- a/src/hotspot/share/runtime/threadSMR.inline.hpp	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/hotspot/share/runtime/threadSMR.inline.hpp	Thu Jan 11 10:45:44 2018 +0100
@@ -53,24 +53,24 @@
 }
 
 // These three inlines are private to ThreadsSMRSupport, but
-// they are called by public inline update_smr_tlh_stats() below:
+// they are called by public inline update_tlh_stats() below:
 
-inline void ThreadsSMRSupport::add_smr_tlh_times(uint add_value) {
-  Atomic::add(add_value, &_smr_tlh_times);
+inline void ThreadsSMRSupport::add_tlh_times(uint add_value) {
+  Atomic::add(add_value, &_tlh_times);
 }
 
-inline void ThreadsSMRSupport::inc_smr_tlh_cnt() {
-  Atomic::inc(&_smr_tlh_cnt);
+inline void ThreadsSMRSupport::inc_tlh_cnt() {
+  Atomic::inc(&_tlh_cnt);
 }
 
-inline void ThreadsSMRSupport::update_smr_tlh_time_max(uint new_value) {
+inline void ThreadsSMRSupport::update_tlh_time_max(uint new_value) {
   while (true) {
-    uint cur_value = _smr_tlh_time_max;
+    uint cur_value = _tlh_time_max;
     if (new_value <= cur_value) {
       // No need to update max value so we're done.
       break;
     }
-    if (Atomic::cmpxchg(new_value, &_smr_tlh_time_max, cur_value) == cur_value) {
+    if (Atomic::cmpxchg(new_value, &_tlh_time_max, cur_value) == cur_value) {
       // Updated max value so we're done. Otherwise try it all again.
       break;
     }
@@ -85,8 +85,8 @@
   return ret;
 }
 
-inline ThreadsList* ThreadsSMRSupport::get_smr_java_thread_list() {
-  return (ThreadsList*)OrderAccess::load_acquire(&_smr_java_thread_list);
+inline ThreadsList* ThreadsSMRSupport::get_java_thread_list() {
+  return (ThreadsList*)OrderAccess::load_acquire(&_java_thread_list);
 }
 
 inline bool ThreadsSMRSupport::is_a_protected_JavaThread_with_lock(JavaThread *thread) {
@@ -94,10 +94,10 @@
   return is_a_protected_JavaThread(thread);
 }
 
-inline void ThreadsSMRSupport::update_smr_tlh_stats(uint millis) {
-  ThreadsSMRSupport::inc_smr_tlh_cnt();
-  ThreadsSMRSupport::add_smr_tlh_times(millis);
-  ThreadsSMRSupport::update_smr_tlh_time_max(millis);
+inline void ThreadsSMRSupport::update_tlh_stats(uint millis) {
+  ThreadsSMRSupport::inc_tlh_cnt();
+  ThreadsSMRSupport::add_tlh_times(millis);
+  ThreadsSMRSupport::update_tlh_time_max(millis);
 }
 
 #endif // SHARE_VM_RUNTIME_THREADSMR_INLINE_HPP
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java	Thu Jan 11 10:45:44 2018 +0100
@@ -48,6 +48,7 @@
         1.8 to 1.8.X 52,0
         1.9 to 1.9.X 53,0
         1.10 to 1.10.X 54,0
+        1.11 to 1.11.X 55,0
     */
 
     public static final Package.Version JAVA_MIN_CLASS_VERSION =
@@ -71,6 +72,9 @@
     public static final Package.Version JAVA10_MAX_CLASS_VERSION =
             Package.Version.of(54, 00);
 
+    public static final Package.Version JAVA11_MAX_CLASS_VERSION =
+            Package.Version.of(55, 00);
+
     public static final int JAVA_PACKAGE_MAGIC = 0xCAFED00D;
 
     public static final Package.Version JAVA5_PACKAGE_VERSION =
@@ -87,7 +91,7 @@
 
     // upper limit, should point to the latest class version
     public static final Package.Version JAVA_MAX_CLASS_VERSION =
-            JAVA10_MAX_CLASS_VERSION;
+            JAVA11_MAX_CLASS_VERSION;
 
     // upper limit should point to the latest package version, for version info!.
     public static final Package.Version MAX_PACKAGE_VERSION =
--- a/src/java.base/share/classes/java/io/ByteArrayOutputStream.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/io/ByteArrayOutputStream.java	Thu Jan 11 10:45:44 2018 +0100
@@ -27,6 +27,7 @@
 
 import java.nio.charset.Charset;
 import java.util.Arrays;
+import java.util.Objects;
 
 /**
  * This class implements an output stream in which the data is
@@ -147,10 +148,7 @@
      * @param   len   the number of bytes to write.
      */
     public synchronized void write(byte b[], int off, int len) {
-        if ((off < 0) || (off > b.length) || (len < 0) ||
-            ((off + len) - b.length > 0)) {
-            throw new IndexOutOfBoundsException();
-        }
+        Objects.checkFromIndexSize(off, len, b.length);
         ensureCapacity(count + len);
         System.arraycopy(b, off, buf, count, len);
         count += len;
--- a/src/java.base/share/classes/java/io/File.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/io/File.java	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2018, 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
@@ -2256,7 +2256,7 @@
     private transient volatile Path filePath;
 
     /**
-     * Returns a {@link Path java.nio.file.Path} object constructed from the
+     * Returns a {@link Path java.nio.file.Path} object constructed from
      * this abstract path. The resulting {@code Path} is associated with the
      * {@link java.nio.file.FileSystems#getDefault default-filesystem}.
      *
--- a/src/java.base/share/classes/java/io/InputStream.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/io/InputStream.java	Thu Jan 11 10:45:44 2018 +0100
@@ -25,7 +25,9 @@
 
 package java.io;
 
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 import java.util.Objects;
 
 /**
@@ -229,30 +231,55 @@
      * @since 9
      */
     public byte[] readAllBytes() throws IOException {
-        byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
-        int capacity = buf.length;
-        int nread = 0;
+        List<byte[]> bufs = null;
+        byte[] result = null;
+        int total = 0;
         int n;
-        for (;;) {
-            // read to EOF which may read more or less than initial buffer size
-            while ((n = read(buf, nread, capacity - nread)) > 0)
+        do {
+            byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
+            int nread = 0;
+
+            // read to EOF which may read more or less than buffer size
+            while ((n = read(buf, nread, buf.length - nread)) > 0) {
                 nread += n;
+            }
 
-            // if the last call to read returned -1, then we're done
-            if (n < 0)
-                break;
+            if (nread > 0) {
+                if (MAX_BUFFER_SIZE - total < nread) {
+                    throw new OutOfMemoryError("Required array size too large");
+                }
+                total += nread;
+                if (result == null) {
+                    result = buf;
+                } else {
+                    if (bufs == null) {
+                        bufs = new ArrayList<>();
+                        bufs.add(result);
+                    }
+                    bufs.add(buf);
+                }
+            }
+        } while (n >= 0); // if the last call to read returned -1, then break
 
-            // need to allocate a larger buffer
-            if (capacity <= MAX_BUFFER_SIZE - capacity) {
-                capacity = capacity << 1;
-            } else {
-                if (capacity == MAX_BUFFER_SIZE)
-                    throw new OutOfMemoryError("Required array size too large");
-                capacity = MAX_BUFFER_SIZE;
+        if (bufs == null) {
+            if (result == null) {
+                return new byte[0];
             }
-            buf = Arrays.copyOf(buf, capacity);
+            return result.length == total ?
+                result : Arrays.copyOf(result, total);
         }
-        return (capacity == nread) ? buf : Arrays.copyOf(buf, nread);
+
+        result = new byte[total];
+        int offset = 0;
+        int remaining = total;
+        for (byte[] b : bufs) {
+            int len = Math.min(b.length, remaining);
+            System.arraycopy(b, 0, result, offset, len);
+            offset += len;
+            remaining -= len;
+        }
+
+        return result;
     }
 
     /**
--- a/src/java.base/share/classes/java/io/ObjectInputStream.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/io/ObjectInputStream.java	Thu Jan 11 10:45:44 2018 +0100
@@ -1296,7 +1296,6 @@
      * @throws InvalidClassException if the filter rejects creation
      */
     private void checkArray(Class<?> arrayType, int arrayLength) throws InvalidClassException {
-        Objects.requireNonNull(arrayType);
         if (! arrayType.isArray()) {
             throw new IllegalArgumentException("not an array type");
         }
--- a/src/java.base/share/classes/java/lang/PublicMethods.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/lang/PublicMethods.java	Thu Jan 11 10:45:44 2018 +0100
@@ -4,7 +4,9 @@
  *
  * 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.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
--- a/src/java.base/share/classes/java/lang/StringConcatHelper.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/lang/StringConcatHelper.java	Thu Jan 11 10:45:44 2018 +0100
@@ -4,7 +4,9 @@
  *
  * 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.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
--- a/src/java.base/share/classes/java/lang/invoke/StringConcatException.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/StringConcatException.java	Thu Jan 11 10:45:44 2018 +0100
@@ -4,7 +4,9 @@
  *
  * 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.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
--- a/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java	Thu Jan 11 10:45:44 2018 +0100
@@ -2521,7 +2521,7 @@
      * the {@code packageFinder} throws an {@link UncheckedIOException} then
      * {@link IOException} cause will be re-thrown. </p>
      *
-     * <p> The module descriptor is read from the buffer stating at index
+     * <p> The module descriptor is read from the buffer starting at index
      * {@code p}, where {@code p} is the buffer's {@link ByteBuffer#position()
      * position} when this method is invoked. Upon return the buffer's position
      * will be equal to {@code p + n} where {@code n} is the number of bytes
--- a/src/java.base/share/classes/java/lang/ref/Reference.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/lang/ref/Reference.java	Thu Jan 11 10:45:44 2018 +0100
@@ -141,14 +141,6 @@
     }
 
     /*
-     * system property to disable clearing before enqueuing.
-     */
-    private static final class ClearBeforeEnqueue {
-        static final boolean DISABLE =
-            Boolean.getBoolean("jdk.lang.ref.disableClearBeforeEnqueue");
-    }
-
-    /*
      * Atomically get and clear (set to null) the VM's pending list.
      */
     private static native Reference<Object> getAndClearReferencePendingList();
@@ -299,8 +291,7 @@
      *           it was not registered with a queue when it was created
      */
     public boolean enqueue() {
-        if (!ClearBeforeEnqueue.DISABLE)
-            this.referent = null;
+        this.referent = null;
         return this.queue.enqueue(this);
     }
 
--- a/src/java.base/share/classes/java/net/InetSocketAddress.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/net/InetSocketAddress.java	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, 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
@@ -317,10 +317,9 @@
     }
 
     /**
-     *
      * Gets the {@code InetAddress}.
      *
-     * @return the InetAdress or {@code null} if it is unresolved.
+     * @return the InetAddress or {@code null} if it is unresolved.
      */
     public final InetAddress getAddress() {
         return holder.getAddress();
--- a/src/java.base/share/classes/java/nio/Bits.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/nio/Bits.java	Thu Jan 11 10:45:44 2018 +0100
@@ -63,38 +63,38 @@
 
     // -- Unsafe access --
 
-    private static final Unsafe unsafe = Unsafe.getUnsafe();
+    private static final Unsafe UNSAFE = Unsafe.getUnsafe();
 
     static Unsafe unsafe() {
-        return unsafe;
+        return UNSAFE;
     }
 
 
     // -- Processor and memory-system properties --
 
-    private static final ByteOrder byteOrder
-        = unsafe.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
+    private static final ByteOrder BYTE_ORDER
+        = UNSAFE.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
 
     static ByteOrder byteOrder() {
-        return byteOrder;
+        return BYTE_ORDER;
     }
 
-    private static int pageSize = -1;
+    private static int PAGE_SIZE = -1;
 
     static int pageSize() {
-        if (pageSize == -1)
-            pageSize = unsafe().pageSize();
-        return pageSize;
+        if (PAGE_SIZE == -1)
+            PAGE_SIZE = unsafe().pageSize();
+        return PAGE_SIZE;
     }
 
     static int pageCount(long size) {
         return (int)(size + (long)pageSize() - 1L) / pageSize();
     }
 
-    private static boolean unaligned = unsafe.unalignedAccess();
+    private static boolean UNALIGNED = UNSAFE.unalignedAccess();
 
     static boolean unaligned() {
-        return unaligned;
+        return UNALIGNED;
     }
 
 
@@ -103,11 +103,11 @@
     // A user-settable upper limit on the maximum amount of allocatable
     // direct buffer memory.  This value may be changed during VM
     // initialization if it is launched with "-XX:MaxDirectMemorySize=<size>".
-    private static volatile long maxMemory = VM.maxDirectMemory();
-    private static final AtomicLong reservedMemory = new AtomicLong();
-    private static final AtomicLong totalCapacity = new AtomicLong();
-    private static final AtomicLong count = new AtomicLong();
-    private static volatile boolean memoryLimitSet;
+    private static volatile long MAX_MEMORY = VM.maxDirectMemory();
+    private static final AtomicLong RESERVED_MEMORY = new AtomicLong();
+    private static final AtomicLong TOTAL_CAPACITY = new AtomicLong();
+    private static final AtomicLong COUNT = new AtomicLong();
+    private static volatile boolean MEMORY_LIMIT_SET;
 
     // max. number of sleeps during try-reserving with exponentially
     // increasing delay before throwing OutOfMemoryError:
@@ -120,9 +120,9 @@
     // which a process may access.  All sizes are specified in bytes.
     static void reserveMemory(long size, int cap) {
 
-        if (!memoryLimitSet && VM.initLevel() >= 1) {
-            maxMemory = VM.maxDirectMemory();
-            memoryLimitSet = true;
+        if (!MEMORY_LIMIT_SET && VM.initLevel() >= 1) {
+            MAX_MEMORY = VM.maxDirectMemory();
+            MEMORY_LIMIT_SET = true;
         }
 
         // optimist!
@@ -200,10 +200,10 @@
         // actual memory usage, which will differ when buffers are page
         // aligned.
         long totalCap;
-        while (cap <= maxMemory - (totalCap = totalCapacity.get())) {
-            if (totalCapacity.compareAndSet(totalCap, totalCap + cap)) {
-                reservedMemory.addAndGet(size);
-                count.incrementAndGet();
+        while (cap <= MAX_MEMORY - (totalCap = TOTAL_CAPACITY.get())) {
+            if (TOTAL_CAPACITY.compareAndSet(totalCap, totalCap + cap)) {
+                RESERVED_MEMORY.addAndGet(size);
+                COUNT.incrementAndGet();
                 return true;
             }
         }
@@ -213,9 +213,9 @@
 
 
     static void unreserveMemory(long size, int cap) {
-        long cnt = count.decrementAndGet();
-        long reservedMem = reservedMemory.addAndGet(-size);
-        long totalCap = totalCapacity.addAndGet(-cap);
+        long cnt = COUNT.decrementAndGet();
+        long reservedMem = RESERVED_MEMORY.addAndGet(-size);
+        long totalCap = TOTAL_CAPACITY.addAndGet(-cap);
         assert cnt >= 0 && reservedMem >= 0 && totalCap >= 0;
     }
 
@@ -234,15 +234,15 @@
                         }
                         @Override
                         public long getCount() {
-                            return Bits.count.get();
+                            return Bits.COUNT.get();
                         }
                         @Override
                         public long getTotalCapacity() {
-                            return Bits.totalCapacity.get();
+                            return Bits.TOTAL_CAPACITY.get();
                         }
                         @Override
                         public long getMemoryUsed() {
-                            return Bits.reservedMemory.get();
+                            return Bits.RESERVED_MEMORY.get();
                         }
                     };
                 }
--- a/src/java.base/share/classes/java/nio/Buffer.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/nio/Buffer.java	Thu Jan 11 10:45:44 2018 +0100
@@ -26,6 +26,7 @@
 package java.nio;
 
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.Unsafe;
 
 import java.util.Spliterator;
 
@@ -181,6 +182,8 @@
  */
 
 public abstract class Buffer {
+    // Cached unsafe-access object
+    static final Unsafe UNSAFE = Bits.unsafe();
 
     /**
      * The characteristics of Spliterators that traverse and split elements
@@ -617,6 +620,14 @@
     // -- Package-private methods for bounds checking, etc. --
 
     /**
+     *
+     * @return the base reference, paired with the address
+     * field, which in combination can be used for unsafe access into a heap
+     * buffer or direct byte buffer (and views of).
+     */
+    abstract Object base();
+
+    /**
      * Checks the current position against the limit, throwing a {@link
      * BufferUnderflowException} if it is not smaller than the limit, and then
      * increments the position.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/java/nio/BufferMismatch.java	Thu Jan 11 10:45:44 2018 +0100
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2017, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package java.nio;
+
+import jdk.internal.util.ArraysSupport;
+
+/**
+ * Mismatch methods for buffers
+ */
+final class BufferMismatch {
+
+    static int mismatch(ByteBuffer a, int aOff, ByteBuffer b, int bOff, int length) {
+        int i = 0;
+        if (length > 7) {
+            i = ArraysSupport.vectorizedMismatch(
+                    a.base(), a.address + aOff,
+                    b.base(), b.address + bOff,
+                    length,
+                    ArraysSupport.LOG2_ARRAY_BYTE_INDEX_SCALE);
+            if (i >= 0) return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a.get(aOff + i) != b.get(bOff + i))
+                return i;
+        }
+        return -1;
+    }
+
+    static int mismatch(CharBuffer a, int aOff, CharBuffer b, int bOff, int length) {
+        int i = 0;
+        // Ensure only heap or off-heap buffer instances use the
+        // vectorized mismatch. If either buffer is a StringCharBuffer
+        // (order is null) then the slow path is taken
+        if (length > 3 && a.charRegionOrder() == b.charRegionOrder()
+            && a.charRegionOrder() != null && b.charRegionOrder() != null) {
+            i = ArraysSupport.vectorizedMismatch(
+                    a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_CHAR_INDEX_SCALE),
+                    b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_CHAR_INDEX_SCALE),
+                    length,
+                    ArraysSupport.LOG2_ARRAY_CHAR_INDEX_SCALE);
+            if (i >= 0) return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a.get(aOff + i) != b.get(bOff + i))
+                return i;
+        }
+        return -1;
+    }
+
+    static int mismatch(ShortBuffer a, int aOff, ShortBuffer b, int bOff, int length) {
+        int i = 0;
+        if (length > 3 && a.order() == b.order()) {
+            i = ArraysSupport.vectorizedMismatch(
+                    a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_SHORT_INDEX_SCALE),
+                    b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_SHORT_INDEX_SCALE),
+                    length,
+                    ArraysSupport.LOG2_ARRAY_SHORT_INDEX_SCALE);
+            if (i >= 0) return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a.get(aOff + i) != b.get(bOff + i))
+                return i;
+        }
+        return -1;
+    }
+
+    static int mismatch(IntBuffer a, int aOff, IntBuffer b, int bOff, int length) {
+        int i = 0;
+        if (length > 1 && a.order() == b.order()) {
+            i = ArraysSupport.vectorizedMismatch(
+                    a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_INT_INDEX_SCALE),
+                    b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_INT_INDEX_SCALE),
+                    length,
+                    ArraysSupport.LOG2_ARRAY_INT_INDEX_SCALE);
+            if (i >= 0) return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a.get(aOff + i) != b.get(bOff + i))
+                return i;
+        }
+        return -1;
+    }
+
+    static int mismatch(FloatBuffer a, int aOff, FloatBuffer b, int bOff, int length) {
+        int i = 0;
+        if (length > 1 && a.order() == b.order()) {
+            i = ArraysSupport.vectorizedMismatch(
+                    a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_FLOAT_INDEX_SCALE),
+                    b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_FLOAT_INDEX_SCALE),
+                    length,
+                    ArraysSupport.LOG2_ARRAY_FLOAT_INDEX_SCALE);
+            // Mismatched
+            if (i >= 0) {
+                // Check if mismatch is not associated with two NaN values; and
+                // is not associated with +0 and -0
+                float av = a.get(aOff + i);
+                float bv = b.get(bOff + i);
+                if (av != bv && (!Float.isNaN(av) || !Float.isNaN(bv)))
+                    return i;
+
+                // Fall back to slow mechanism
+                // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+                // However, requires that returned value be relative to input ranges
+                i++;
+            }
+            // Matched
+            else {
+                i = length - ~i;
+            }
+        }
+        for (; i < length; i++) {
+            float av = a.get(aOff + i);
+            float bv = b.get(bOff + i);
+            if (av != bv && (!Float.isNaN(av) || !Float.isNaN(bv)))
+                return i;
+        }
+        return -1;
+    }
+
+    static int mismatch(LongBuffer a, int aOff, LongBuffer b, int bOff, int length) {
+        int i = 0;
+        if (length > 0 && a.order() == b.order()) {
+            i = ArraysSupport.vectorizedMismatch(
+                    a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_LONG_INDEX_SCALE),
+                    b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_LONG_INDEX_SCALE),
+                    length,
+                    ArraysSupport.LOG2_ARRAY_LONG_INDEX_SCALE);
+            return i >= 0 ? i : -1;
+        }
+        for (; i < length; i++) {
+            if (a.get(aOff + i) != b.get(bOff + i))
+                return i;
+        }
+        return -1;
+    }
+
+    static int mismatch(DoubleBuffer a, int aOff, DoubleBuffer b, int bOff, int length) {
+        int i = 0;
+        if (length > 0 && a.order() == b.order()) {
+            i = ArraysSupport.vectorizedMismatch(
+                    a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_DOUBLE_INDEX_SCALE),
+                    b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_DOUBLE_INDEX_SCALE),
+                    length,
+                    ArraysSupport.LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+            // Mismatched
+            if (i >= 0) {
+                // Check if mismatch is not associated with two NaN values; and
+                // is not associated with +0 and -0
+                double av = a.get(aOff + i);
+                double bv = b.get(bOff + i);
+                if (av != bv && (!Double.isNaN(av) || !Double.isNaN(bv)))
+                    return i;
+
+                // Fall back to slow mechanism
+                // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+                // However, requires that returned value be relative to input ranges
+                i++;
+            }
+            // Matched
+            else {
+                return -1;
+            }
+        }
+        for (; i < length; i++) {
+            double av = a.get(aOff + i);
+            double bv = b.get(bOff + i);
+            if (av != bv && (!Double.isNaN(av) || !Double.isNaN(bv)))
+                return i;
+        }
+        return -1;
+    }
+}
--- a/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template	Thu Jan 11 10:45:44 2018 +0100
@@ -36,9 +36,6 @@
 
 #if[rw]
 
-    // Cached unsafe-access object
-    private static final Unsafe unsafe = Bits.unsafe();
-
     protected final ByteBuffer bb;
 
 #end[rw]
@@ -74,6 +71,11 @@
 #end[rw]
     }
 
+    @Override
+    Object base() {
+        return bb.hb;
+    }
+
     public $Type$Buffer slice() {
         int pos = this.position();
         int lim = this.limit();
@@ -117,20 +119,20 @@
     }
 
     public $type$ get() {
-        $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(nextGetIndex()),
+        $memtype$ x = UNSAFE.get$Memtype$Unaligned(bb.hb, byteOffset(nextGetIndex()),
             {#if[boB]?true:false});
         return $fromBits$(x);
     }
 
     public $type$ get(int i) {
-        $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)),
+        $memtype$ x = UNSAFE.get$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)),
             {#if[boB]?true:false});
         return $fromBits$(x);
     }
 
 #if[streamableType]
    $type$ getUnchecked(int i) {
-        $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(i),
+        $memtype$ x = UNSAFE.get$Memtype$Unaligned(bb.hb, byteOffset(i),
             {#if[boB]?true:false});
         return $fromBits$(x);
     }
@@ -141,7 +143,7 @@
     public $Type$Buffer put($type$ x) {
 #if[rw]
         $memtype$ y = $toBits$(x);
-        unsafe.put$Memtype$Unaligned(bb.hb, byteOffset(nextPutIndex()), y,
+        UNSAFE.put$Memtype$Unaligned(bb.hb, byteOffset(nextPutIndex()), y,
             {#if[boB]?true:false});
         return this;
 #else[rw]
@@ -152,7 +154,7 @@
     public $Type$Buffer put(int i, $type$ x) {
 #if[rw]
         $memtype$ y = $toBits$(x);
-        unsafe.put$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)), y,
+        UNSAFE.put$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)), y,
             {#if[boB]?true:false});
         return this;
 #else[rw]
@@ -241,4 +243,9 @@
 #end[boL]
     }
 
+#if[char]
+    ByteOrder charRegionOrder() {
+        return order();
+    }
+#end[char]
 }
--- a/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template	Thu Jan 11 10:45:44 2018 +0100
@@ -32,7 +32,7 @@
 #if[rw]
 
     private $type$ get$Type$(long a) {
-        $memtype$ x = unsafe.get$Memtype$Unaligned(null, a, bigEndian);
+        $memtype$ x = UNSAFE.get$Memtype$Unaligned(null, a, bigEndian);
         return $fromBits$(x);
     }
 
@@ -49,7 +49,7 @@
     private ByteBuffer put$Type$(long a, $type$ x) {
 #if[rw]
         $memtype$ y = $toBits$(x);
-        unsafe.put$Memtype$Unaligned(null, a, y, bigEndian);
+        UNSAFE.put$Memtype$Unaligned(null, a, y, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -81,7 +81,7 @@
         int rem = (off <= lim ? lim - off : 0);
 
         int size = rem >> $LG_BYTES_PER_VALUE$;
-        if (!unaligned && ((address + off) % $BYTES_PER_VALUE$ != 0)) {
+        if (!UNALIGNED && ((address + off) % $BYTES_PER_VALUE$ != 0)) {
             return (bigEndian
                     ? ($Type$Buffer)(new ByteBufferAs$Type$Buffer$RW$B(this,
                                                                        -1,
--- a/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Thu Jan 11 10:45:44 2018 +0100
@@ -28,7 +28,6 @@
 package java.nio;
 
 import java.io.FileDescriptor;
-import jdk.internal.misc.Unsafe;
 import jdk.internal.misc.VM;
 import jdk.internal.ref.Cleaner;
 import sun.nio.ch.DirectBuffer;
@@ -45,14 +44,11 @@
 
 #if[rw]
 
-    // Cached unsafe-access object
-    protected static final Unsafe unsafe = Bits.unsafe();
-
     // Cached array base offset
-    private static final long arrayBaseOffset = (long)unsafe.arrayBaseOffset($type$[].class);
+    private static final long ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset($type$[].class);
 
     // Cached unaligned-access capability
-    protected static final boolean unaligned = Bits.unaligned();
+    protected static final boolean UNALIGNED = Bits.unaligned();
 
     // Base address, used in all indexing calculations
     // NOTE: moved up to Buffer.java for speed in JNI GetDirectBufferAddress
@@ -73,8 +69,6 @@
         implements Runnable
     {
 
-        private static Unsafe unsafe = Unsafe.getUnsafe();
-
         private long address;
         private long size;
         private int capacity;
@@ -91,7 +85,7 @@
                 // Paranoia
                 return;
             }
-            unsafe.freeMemory(address);
+            UNSAFE.freeMemory(address);
             address = 0;
             Bits.unreserveMemory(size, capacity);
         }
@@ -124,12 +118,12 @@
 
         long base = 0;
         try {
-            base = unsafe.allocateMemory(size);
+            base = UNSAFE.allocateMemory(size);
         } catch (OutOfMemoryError x) {
             Bits.unreserveMemory(size, cap);
             throw x;
         }
-        unsafe.setMemory(base, size, (byte) 0);
+        UNSAFE.setMemory(base, size, (byte) 0);
         if (pa && (base % ps != 0)) {
             // Round up to page boundary
             address = base + ps - (base & (ps - 1));
@@ -206,6 +200,11 @@
 #end[rw]
     }
 
+    @Override
+    Object base() {
+        return null;
+    }
+
     public $Type$Buffer slice() {
         int pos = this.position();
         int lim = this.limit();
@@ -258,16 +257,16 @@
     }
 
     public $type$ get() {
-        return $fromBits$($swap$(unsafe.get$Swaptype$(ix(nextGetIndex()))));
+        return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(nextGetIndex()))));
     }
 
     public $type$ get(int i) {
-        return $fromBits$($swap$(unsafe.get$Swaptype$(ix(checkIndex(i)))));
+        return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(checkIndex(i)))));
     }
 
 #if[streamableType]
     $type$ getUnchecked(int i) {
-        return $fromBits$($swap$(unsafe.get$Swaptype$(ix(i))));
+        return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(i))));
     }
 #end[streamableType]
 
@@ -282,10 +281,10 @@
             if (length > rem)
                 throw new BufferUnderflowException();
 
-            long dstOffset = arrayBaseOffset + ((long)offset << $LG_BYTES_PER_VALUE$);
+            long dstOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
 #if[!byte]
             if (order() != ByteOrder.nativeOrder())
-                unsafe.copySwapMemory(null,
+                UNSAFE.copySwapMemory(null,
                                       ix(pos),
                                       dst,
                                       dstOffset,
@@ -293,7 +292,7 @@
                                       (long)1 << $LG_BYTES_PER_VALUE$);
             else
 #end[!byte]
-                unsafe.copyMemory(null,
+                UNSAFE.copyMemory(null,
                                   ix(pos),
                                   dst,
                                   dstOffset,
@@ -312,7 +311,7 @@
 
     public $Type$Buffer put($type$ x) {
 #if[rw]
-        unsafe.put$Swaptype$(ix(nextPutIndex()), $swap$($toBits$(x)));
+        UNSAFE.put$Swaptype$(ix(nextPutIndex()), $swap$($toBits$(x)));
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -321,7 +320,7 @@
 
     public $Type$Buffer put(int i, $type$ x) {
 #if[rw]
-        unsafe.put$Swaptype$(ix(checkIndex(i)), $swap$($toBits$(x)));
+        UNSAFE.put$Swaptype$(ix(checkIndex(i)), $swap$($toBits$(x)));
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -347,7 +346,7 @@
 
             if (srem > rem)
                 throw new BufferOverflowException();
-            unsafe.copyMemory(sb.ix(spos), ix(pos), (long)srem << $LG_BYTES_PER_VALUE$);
+            UNSAFE.copyMemory(sb.ix(spos), ix(pos), (long)srem << $LG_BYTES_PER_VALUE$);
             sb.position(spos + srem);
             position(pos + srem);
         } else if (src.hb != null) {
@@ -380,10 +379,10 @@
             if (length > rem)
                 throw new BufferOverflowException();
 
-            long srcOffset = arrayBaseOffset + ((long)offset << $LG_BYTES_PER_VALUE$);
+            long srcOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
 #if[!byte]
             if (order() != ByteOrder.nativeOrder())
-                unsafe.copySwapMemory(src,
+                UNSAFE.copySwapMemory(src,
                                       srcOffset,
                                       null,
                                       ix(pos),
@@ -391,7 +390,7 @@
                                       (long)1 << $LG_BYTES_PER_VALUE$);
             else
 #end[!byte]
-                unsafe.copyMemory(src,
+                UNSAFE.copyMemory(src,
                                   srcOffset,
                                   null,
                                   ix(pos),
@@ -413,7 +412,7 @@
         assert (pos <= lim);
         int rem = (pos <= lim ? lim - pos : 0);
 
-        unsafe.copyMemory(ix(pos), ix(0), (long)rem << $LG_BYTES_PER_VALUE$);
+        UNSAFE.copyMemory(ix(pos), ix(0), (long)rem << $LG_BYTES_PER_VALUE$);
         position(rem);
         limit(capacity());
         discardMark();
@@ -490,17 +489,22 @@
 
 #end[!byte]
 
+#if[char]
+    ByteOrder charRegionOrder() {
+        return order();
+    }
+#end[char]
 
 
 #if[byte]
 
     byte _get(int i) {                          // package-private
-        return unsafe.getByte(address + i);
+        return UNSAFE.getByte(address + i);
     }
 
     void _put(int i, byte b) {                  // package-private
 #if[rw]
-        unsafe.putByte(address + i, b);
+        UNSAFE.putByte(address + i, b);
 #else[rw]
         throw new ReadOnlyBufferException();
 #end[rw]
--- a/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template	Thu Jan 11 10:45:44 2018 +0100
@@ -27,8 +27,6 @@
 
 package java.nio;
 
-import jdk.internal.misc.Unsafe;
-
 /**
 #if[rw]
  * A read/write Heap$Type$Buffer.
@@ -43,6 +41,11 @@
 class Heap$Type$Buffer$RW$
     extends {#if[ro]?Heap}$Type$Buffer
 {
+    // Cached array base offset
+    private static final long ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset($type$[].class);
+
+    // Cached array base offset
+    private static final long ARRAY_INDEX_SCALE = UNSAFE.arrayIndexScale($type$[].class);
 
     // For speed these fields are actually declared in X-Buffer;
     // these declarations are here as documentation
@@ -53,16 +56,6 @@
 #end[rw]
     */
 
-#if[byte]
-
-    // Cached unsafe-access object
-    private static final Unsafe unsafe = Bits.unsafe();
-
-    // Cached array base offset
-    private static final long arrayBaseOffset = unsafe.arrayBaseOffset($type$[].class);
-
-#end[byte]
-
     Heap$Type$Buffer$RW$(int cap, int lim) {            // package-private
 #if[rw]
         super(-1, 0, lim, cap, new $type$[cap], 0);
@@ -70,13 +63,11 @@
         hb = new $type$[cap];
         offset = 0;
         */
+        this.address = ARRAY_BASE_OFFSET;
 #else[rw]
         super(cap, lim);
         this.isReadOnly = true;
 #end[rw]
-#if[byte]
-        this.address = arrayBaseOffset;
-#end[byte]
     }
 
     Heap$Type$Buffer$RW$($type$[] buf, int off, int len) { // package-private
@@ -86,13 +77,11 @@
         hb = buf;
         offset = 0;
         */
+        this.address = ARRAY_BASE_OFFSET;
 #else[rw]
         super(buf, off, len);
         this.isReadOnly = true;
 #end[rw]
-#if[byte]
-        this.address = arrayBaseOffset;
-#end[byte]
     }
 
     protected Heap$Type$Buffer$RW$($type$[] buf,
@@ -105,13 +94,11 @@
         hb = buf;
         offset = off;
         */
+        this.address = ARRAY_BASE_OFFSET + off * ARRAY_INDEX_SCALE;
 #else[rw]
         super(buf, mark, pos, lim, cap, off);
         this.isReadOnly = true;
 #end[rw]
-#if[byte]
-        this.address = arrayBaseOffset + off;
-#end[byte]
     }
 
     public $Type$Buffer slice() {
@@ -296,18 +283,18 @@
 #if[rw]
 
     public char getChar() {
-        return unsafe.getCharUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
+        return UNSAFE.getCharUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
     }
 
     public char getChar(int i) {
-        return unsafe.getCharUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
+        return UNSAFE.getCharUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
     }
 
 #end[rw]
 
     public $Type$Buffer putChar(char x) {
 #if[rw]
-        unsafe.putCharUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
+        UNSAFE.putCharUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -316,7 +303,7 @@
 
     public $Type$Buffer putChar(int i, char x) {
 #if[rw]
-        unsafe.putCharUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
+        UNSAFE.putCharUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -347,18 +334,18 @@
 #if[rw]
 
     public short getShort() {
-        return unsafe.getShortUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
+        return UNSAFE.getShortUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
     }
 
     public short getShort(int i) {
-        return unsafe.getShortUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
+        return UNSAFE.getShortUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
     }
 
 #end[rw]
 
     public $Type$Buffer putShort(short x) {
 #if[rw]
-        unsafe.putShortUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
+        UNSAFE.putShortUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -367,7 +354,7 @@
 
     public $Type$Buffer putShort(int i, short x) {
 #if[rw]
-        unsafe.putShortUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
+        UNSAFE.putShortUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -398,18 +385,18 @@
 #if[rw]
 
     public int getInt() {
-        return unsafe.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
+        return UNSAFE.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
     }
 
     public int getInt(int i) {
-        return unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
+        return UNSAFE.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
     }
 
 #end[rw]
 
     public $Type$Buffer putInt(int x) {
 #if[rw]
-        unsafe.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), x, bigEndian);
+        UNSAFE.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), x, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -418,7 +405,7 @@
 
     public $Type$Buffer putInt(int i, int x) {
 #if[rw]
-        unsafe.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), x, bigEndian);
+        UNSAFE.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), x, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -449,18 +436,18 @@
 #if[rw]
 
     public long getLong() {
-        return unsafe.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
+        return UNSAFE.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
     }
 
     public long getLong(int i) {
-        return unsafe.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
+        return UNSAFE.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
     }
 
 #end[rw]
 
     public $Type$Buffer putLong(long x) {
 #if[rw]
-        unsafe.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), x, bigEndian);
+        UNSAFE.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), x, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -469,7 +456,7 @@
 
     public $Type$Buffer putLong(int i, long x) {
 #if[rw]
-        unsafe.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), x, bigEndian);
+        UNSAFE.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), x, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -500,12 +487,12 @@
 #if[rw]
 
     public float getFloat() {
-        int x = unsafe.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
+        int x = UNSAFE.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
         return Float.intBitsToFloat(x);
     }
 
     public float getFloat(int i) {
-        int x = unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
+        int x = UNSAFE.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
         return Float.intBitsToFloat(x);
     }
 
@@ -514,7 +501,7 @@
     public $Type$Buffer putFloat(float x) {
 #if[rw]
         int y = Float.floatToRawIntBits(x);
-        unsafe.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian);
+        UNSAFE.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -524,7 +511,7 @@
     public $Type$Buffer putFloat(int i, float x) {
 #if[rw]
         int y = Float.floatToRawIntBits(x);
-        unsafe.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), y, bigEndian);
+        UNSAFE.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), y, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -555,12 +542,12 @@
 #if[rw]
 
     public double getDouble() {
-        long x = unsafe.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
+        long x = UNSAFE.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
         return Double.longBitsToDouble(x);
     }
 
     public double getDouble(int i) {
-        long x = unsafe.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
+        long x = UNSAFE.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
         return Double.longBitsToDouble(x);
     }
 
@@ -569,7 +556,7 @@
     public $Type$Buffer putDouble(double x) {
 #if[rw]
         long y = Double.doubleToRawLongBits(x);
-        unsafe.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), y, bigEndian);
+        UNSAFE.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), y, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -579,7 +566,7 @@
     public $Type$Buffer putDouble(int i, double x) {
 #if[rw]
         long y = Double.doubleToRawLongBits(x);
-        unsafe.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), y, bigEndian);
+        UNSAFE.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), y, bigEndian);
         return this;
 #else[rw]
         throw new ReadOnlyBufferException();
@@ -643,7 +630,11 @@
     public ByteOrder order() {
         return ByteOrder.nativeOrder();
     }
+#end[!byte]
+#if[char]
 
-#end[!byte]
-
+    ByteOrder charRegionOrder() {
+        return order();
+    }
+#end[char]
 }
--- a/src/java.base/share/classes/java/nio/StringCharBuffer.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/nio/StringCharBuffer.java	Thu Jan 11 10:45:44 2018 +0100
@@ -127,4 +127,30 @@
         return ByteOrder.nativeOrder();
     }
 
+    ByteOrder charRegionOrder() {
+        return null;
+    }
+
+    public boolean equals(Object ob) {
+        if (this == ob)
+            return true;
+        if (!(ob instanceof CharBuffer))
+            return false;
+        CharBuffer that = (CharBuffer)ob;
+        if (this.remaining() != that.remaining())
+            return false;
+        return BufferMismatch.mismatch(this, this.position(),
+                                       that, that.position(),
+                                       this.remaining()) < 0;
+    }
+
+    public int compareTo(CharBuffer that) {
+        int i = BufferMismatch.mismatch(this, this.position(),
+                                        that, that.position(),
+                                        Math.min(this.remaining(), that.remaining()));
+        if (i >= 0) {
+            return Character.compare(this.get(this.position() + i), that.get(this.position() + i));
+        }
+        return this.remaining() - that.remaining();
+    }
 }
--- a/src/java.base/share/classes/java/nio/X-Buffer.java.template	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/nio/X-Buffer.java.template	Thu Jan 11 10:45:44 2018 +0100
@@ -36,6 +36,8 @@
 import java.util.stream.$Streamtype$Stream;
 #end[streamableType]
 
+import jdk.internal.util.ArraysSupport;
+
 /**
  * $A$ $type$ buffer.
  *
@@ -287,6 +289,11 @@
         this(mark, pos, lim, cap, null, 0);
     }
 
+    @Override
+    Object base() {
+        return hb;
+    }
+
 #if[byte]
 
     /**
@@ -1297,19 +1304,9 @@
         $Type$Buffer that = ($Type$Buffer)ob;
         if (this.remaining() != that.remaining())
             return false;
-        int p = this.position();
-        for (int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j--)
-            if (!equals(this.get(i), that.get(j)))
-                return false;
-        return true;
-    }
-
-    private static boolean equals($type$ x, $type$ y) {
-#if[floatingPointType]
-        return (x == y) || ($Fulltype$.isNaN(x) && $Fulltype$.isNaN(y));
-#else[floatingPointType]
-        return x == y;
-#end[floatingPointType]
+        return BufferMismatch.mismatch(this, this.position(),
+                                       that, that.position(),
+                                       this.remaining()) < 0;
     }
 
     /**
@@ -1336,11 +1333,11 @@
      *          is less than, equal to, or greater than the given buffer
      */
     public int compareTo($Type$Buffer that) {
-        int n = this.position() + Math.min(this.remaining(), that.remaining());
-        for (int i = this.position(), j = that.position(); i < n; i++, j++) {
-            int cmp = compare(this.get(i), that.get(j));
-            if (cmp != 0)
-                return cmp;
+        int i = BufferMismatch.mismatch(this, this.position(),
+                                        that, that.position(),
+                                        Math.min(this.remaining(), that.remaining()));
+        if (i >= 0) {
+            return compare(this.get(this.position() + i), that.get(this.position() + i));
         }
         return this.remaining() - that.remaining();
     }
@@ -1571,6 +1568,12 @@
 
 #end[!byte]
 
+#if[char]
+    // The order or null if the buffer does not cover a memory region,
+    // such as StringCharBuffer
+    abstract ByteOrder charRegionOrder();
+#end[char]
+
 #if[byte]
 
     boolean bigEndian                                   // package-private
--- a/src/java.base/share/classes/java/nio/file/Files.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/nio/file/Files.java	Thu Jan 11 10:45:44 2018 +0100
@@ -2955,22 +2955,6 @@
     }
 
     /**
-     * Reads all bytes from an input stream and writes them to an output stream.
-     */
-    private static long copy(InputStream source, OutputStream sink)
-        throws IOException
-    {
-        long nread = 0L;
-        byte[] buf = new byte[BUFFER_SIZE];
-        int n;
-        while ((n = source.read(buf)) > 0) {
-            sink.write(buf, 0, n);
-            nread += n;
-        }
-        return nread;
-    }
-
-    /**
      * Copies all bytes from an input stream to a file. On return, the input
      * stream will be at end of stream.
      *
@@ -3082,7 +3066,7 @@
 
         // do the copy
         try (OutputStream out = ostream) {
-            return copy(in, out);
+            return in.transferTo(out);
         }
     }
 
@@ -3124,7 +3108,7 @@
         Objects.requireNonNull(out);
 
         try (InputStream in = newInputStream(source)) {
-            return copy(in, out);
+            return in.transferTo(out);
         }
     }
 
--- a/src/java.base/share/classes/java/util/Arrays.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/util/Arrays.java	Thu Jan 11 10:45:44 2018 +0100
@@ -26,6 +26,7 @@
 package java.util;
 
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.util.ArraysSupport;
 
 import java.lang.reflect.Array;
 import java.util.concurrent.ForkJoinPool;
--- a/src/java.base/share/classes/java/util/ArraysSupport.java	Wed Dec 20 11:57:20 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,545 +0,0 @@
-/*
- * Copyright (c) 2015, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-package java.util;
-
-import jdk.internal.HotSpotIntrinsicCandidate;
-import jdk.internal.misc.Unsafe;
-
-/**
- * Utility methods to find a mismatch between two primitive arrays.
- *
- * <p>Array equality and lexicographical comparison can be built on top of
- * array mismatch functionality.
- *
- * <p>The mismatch method implementation, {@link #vectorizedMismatch}, leverages
- * vector-based techniques to access and compare the contents of two arrays.
- * The Java implementation uses {@code Unsafe.getLongUnaligned} to access the
- * content of an array, thus access is supported on platforms that do not
- * support unaligned access.  For a byte[] array, 8 bytes (64 bits) can be
- * accessed and compared as a unit rather than individually, which increases
- * the performance when the method is compiled by the HotSpot VM.  On supported
- * platforms the mismatch implementation is intrinsified to leverage SIMD
- * instructions.  So for a byte[] array, 16 bytes (128 bits), 32 bytes
- * (256 bits), and perhaps in the future even 64 bytes (512 bits), platform
- * permitting, can be accessed and compared as a unit, which further increases
- * the performance over the Java implementation.
- *
- * <p>None of the mismatch methods perform array bounds checks.  It is the
- * responsibility of the caller (direct or otherwise) to perform such checks
- * before calling this method.
- */
-class ArraysSupport {
-    static final Unsafe U = Unsafe.getUnsafe();
-
-    private static final boolean BIG_ENDIAN = U.isBigEndian();
-
-    private static final int LOG2_ARRAY_BOOLEAN_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
-    private static final int LOG2_ARRAY_BYTE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BYTE_INDEX_SCALE);
-    private static final int LOG2_ARRAY_CHAR_INDEX_SCALE = exactLog2(Unsafe.ARRAY_CHAR_INDEX_SCALE);
-    private static final int LOG2_ARRAY_SHORT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_SHORT_INDEX_SCALE);
-    private static final int LOG2_ARRAY_INT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_INT_INDEX_SCALE);
-    private static final int LOG2_ARRAY_LONG_INDEX_SCALE = exactLog2(Unsafe.ARRAY_LONG_INDEX_SCALE);
-    private static final int LOG2_ARRAY_FLOAT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_FLOAT_INDEX_SCALE);
-    private static final int LOG2_ARRAY_DOUBLE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_DOUBLE_INDEX_SCALE);
-
-    private static final int LOG2_BYTE_BIT_SIZE = exactLog2(Byte.SIZE);
-
-    private static int exactLog2(int scale) {
-        if ((scale & (scale - 1)) != 0)
-            throw new Error("data type scale not a power of two");
-        return Integer.numberOfTrailingZeros(scale);
-    }
-
-    private ArraysSupport() {}
-
-    /**
-     * Find the relative index of the first mismatching pair of elements in two
-     * primitive arrays of the same component type.  Pairs of elements will be
-     * tested in order relative to given offsets into both arrays.
-     *
-     * <p>This method does not perform type checks or bounds checks.  It is the
-     * responsibility of the caller to perform such checks before calling this
-     * method.
-     *
-     * <p>The given offsets, in bytes, need not be aligned according to the
-     * given log<sub>2</sub> size the array elements.  More specifically, an
-     * offset modulus the size need not be zero.
-     *
-     * @param a the first array to be tested for mismatch, or {@code null} for
-     * direct memory access
-     * @param aOffset the relative offset, in bytes, from the base address of
-     * the first array to test from, otherwise if the first array is
-     * {@code null}, an absolute address pointing to the first element to test.
-     * @param b the second array to be tested for mismatch, or {@code null} for
-     * direct memory access
-     * @param bOffset the relative offset, in bytes, from the base address of
-     * the second array to test from, otherwise if the second array is
-     * {@code null}, an absolute address pointing to the first element to test.
-     * @param length the number of array elements to test
-     * @param log2ArrayIndexScale log<sub>2</sub> of the array index scale, that
-     * corresponds to the size, in bytes, of an array element.
-     * @return if a mismatch is found a relative index, between 0 (inclusive)
-     * and {@code length} (exclusive), of the first mismatching pair of elements
-     * in the two arrays.  Otherwise, if a mismatch is not found the bitwise
-     * compliment of the number of remaining pairs of elements to be checked in
-     * the tail of the two arrays.
-     */
-    @HotSpotIntrinsicCandidate
-    static int vectorizedMismatch(Object a, long aOffset,
-                                  Object b, long bOffset,
-                                  int length,
-                                  int log2ArrayIndexScale) {
-        // assert a.getClass().isArray();
-        // assert b.getClass().isArray();
-        // assert 0 <= length <= sizeOf(a)
-        // assert 0 <= length <= sizeOf(b)
-        // assert 0 <= log2ArrayIndexScale <= 3
-
-        int log2ValuesPerWidth = LOG2_ARRAY_LONG_INDEX_SCALE - log2ArrayIndexScale;
-        int wi = 0;
-        for (; wi < length >> log2ValuesPerWidth; wi++) {
-            long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
-            long av = U.getLongUnaligned(a, aOffset + bi);
-            long bv = U.getLongUnaligned(b, bOffset + bi);
-            if (av != bv) {
-                long x = av ^ bv;
-                int o = BIG_ENDIAN
-                        ? Long.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
-                        : Long.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
-                return (wi << log2ValuesPerWidth) + o;
-            }
-        }
-
-        // Calculate the tail of remaining elements to check
-        int tail = length - (wi << log2ValuesPerWidth);
-
-        if (log2ArrayIndexScale < LOG2_ARRAY_INT_INDEX_SCALE) {
-            int wordTail = 1 << (LOG2_ARRAY_INT_INDEX_SCALE - log2ArrayIndexScale);
-            // Handle 4 bytes or 2 chars in the tail using int width
-            if (tail >= wordTail) {
-                long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
-                int av = U.getIntUnaligned(a, aOffset + bi);
-                int bv = U.getIntUnaligned(b, bOffset + bi);
-                if (av != bv) {
-                    int x = av ^ bv;
-                    int o = BIG_ENDIAN
-                            ? Integer.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
-                            : Integer.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
-                    return (wi << log2ValuesPerWidth) + o;
-                }
-                tail -= wordTail;
-            }
-            return ~tail;
-        }
-        else {
-            return ~tail;
-        }
-    }
-
-    // Booleans
-    // Each boolean element takes up one byte
-
-    static int mismatch(boolean[] a,
-                        boolean[] b,
-                        int length) {
-        int i = 0;
-        if (length > 7) {
-            i = vectorizedMismatch(
-                    a, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
-                    b, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
-                    length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
-            if (i >= 0)
-                return i;
-            i = length - ~i;
-        }
-        for (; i < length; i++) {
-            if (a[i] != b[i])
-                return i;
-        }
-        return -1;
-    }
-
-    static int mismatch(boolean[] a, int aFromIndex,
-                        boolean[] b, int bFromIndex,
-                        int length) {
-        int i = 0;
-        if (length > 7) {
-            int aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
-            int bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
-            i = vectorizedMismatch(
-                    a, aOffset,
-                    b, bOffset,
-                    length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
-            if (i >= 0)
-                return i;
-            i = length - ~i;
-        }
-        for (; i < length; i++) {
-            if (a[aFromIndex + i] != b[bFromIndex + i])
-                return i;
-        }
-        return -1;
-    }
-
-
-    // Bytes
-
-    /**
-     * Find the index of a mismatch between two arrays.
-     *
-     * <p>This method does not perform bounds checks. It is the responsibility
-     * of the caller to perform such bounds checks before calling this method.
-     *
-     * @param a the first array to be tested for a mismatch
-     * @param b the second array to be tested for a mismatch
-     * @param length the number of bytes from each array to check
-     * @return the index of a mismatch between the two arrays, otherwise -1 if
-     * no mismatch.  The index will be within the range of (inclusive) 0 to
-     * (exclusive) the smaller of the two array lengths.
-     */
-    static int mismatch(byte[] a,
-                        byte[] b,
-                        int length) {
-        // ISSUE: defer to index receiving methods if performance is good
-        // assert length <= a.length
-        // assert length <= b.length
-
-        int i = 0;
-        if (length > 7) {
-            i = vectorizedMismatch(
-                    a, Unsafe.ARRAY_BYTE_BASE_OFFSET,
-                    b, Unsafe.ARRAY_BYTE_BASE_OFFSET,
-                    length, LOG2_ARRAY_BYTE_INDEX_SCALE);
-            if (i >= 0)
-                return i;
-            // Align to tail
-            i = length - ~i;
-//            assert i >= 0 && i <= 7;
-        }
-        // Tail < 8 bytes
-        for (; i < length; i++) {
-            if (a[i] != b[i])
-                return i;
-        }
-        return -1;
-    }
-
-    /**
-     * Find the relative index of a mismatch between two arrays starting from
-     * given indexes.
-     *
-     * <p>This method does not perform bounds checks. It is the responsibility
-     * of the caller to perform such bounds checks before calling this method.
-     *
-     * @param a the first array to be tested for a mismatch
-     * @param aFromIndex the index of the first element (inclusive) in the first
-     * array to be compared
-     * @param b the second array to be tested for a mismatch
-     * @param bFromIndex the index of the first element (inclusive) in the
-     * second array to be compared
-     * @param length the number of bytes from each array to check
-     * @return the relative index of a mismatch between the two arrays,
-     * otherwise -1 if no mismatch.  The index will be within the range of
-     * (inclusive) 0 to (exclusive) the smaller of the two array bounds.
-     */
-    static int mismatch(byte[] a, int aFromIndex,
-                        byte[] b, int bFromIndex,
-                        int length) {
-        // assert 0 <= aFromIndex < a.length
-        // assert 0 <= aFromIndex + length <= a.length
-        // assert 0 <= bFromIndex < b.length
-        // assert 0 <= bFromIndex + length <= b.length
-        // assert length >= 0
-
-        int i = 0;
-        if (length > 7) {
-            int aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
-            int bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
-            i = vectorizedMismatch(
-                    a, aOffset,
-                    b, bOffset,
-                    length, LOG2_ARRAY_BYTE_INDEX_SCALE);
-            if (i >= 0)
-                return i;
-            i = length - ~i;
-        }
-        for (; i < length; i++) {
-            if (a[aFromIndex + i] != b[bFromIndex + i])
-                return i;
-        }
-        return -1;
-    }
-
-
-    // Chars
-
-    static int mismatch(char[] a,
-                        char[] b,
-                        int length) {
-        int i = 0;
-        if (length > 3) {
-            i = vectorizedMismatch(
-                    a, Unsafe.ARRAY_CHAR_BASE_OFFSET,
-                    b, Unsafe.ARRAY_CHAR_BASE_OFFSET,
-                    length, LOG2_ARRAY_CHAR_INDEX_SCALE);
-            if (i >= 0)
-                return i;
-            i = length - ~i;
-        }
-        for (; i < length; i++) {
-            if (a[i] != b[i])
-                return i;
-        }
-        return -1;
-    }
-
-    static int mismatch(char[] a, int aFromIndex,
-                        char[] b, int bFromIndex,
-                        int length) {
-        int i = 0;
-        if (length > 3) {
-            int aOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
-            int bOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
-            i = vectorizedMismatch(
-                    a, aOffset,
-                    b, bOffset,
-                    length, LOG2_ARRAY_CHAR_INDEX_SCALE);
-            if (i >= 0)
-                return i;
-            i = length - ~i;
-        }
-        for (; i < length; i++) {
-            if (a[aFromIndex + i] != b[bFromIndex + i])
-                return i;
-        }
-        return -1;
-    }
-
-
-    // Shorts
-
-    static int mismatch(short[] a,
-                        short[] b,
-                        int length) {
-        int i = 0;
-        if (length > 3) {
-            i = vectorizedMismatch(
-                    a, Unsafe.ARRAY_SHORT_BASE_OFFSET,
-                    b, Unsafe.ARRAY_SHORT_BASE_OFFSET,
-                    length, LOG2_ARRAY_SHORT_INDEX_SCALE);
-            if (i >= 0)
-                return i;
-            i = length - ~i;
-        }
-        for (; i < length; i++) {
-            if (a[i] != b[i])
-                return i;
-        }
-        return -1;
-    }
-
-    static int mismatch(short[] a, int aFromIndex,
-                        short[] b, int bFromIndex,
-                        int length) {
-        int i = 0;
-        if (length > 3) {
-            int aOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
-            int bOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
-            i = vectorizedMismatch(
-                    a, aOffset,
-                    b, bOffset,
-                    length, LOG2_ARRAY_SHORT_INDEX_SCALE);
-            if (i >= 0)
-                return i;
-            i = length - ~i;
-        }
-        for (; i < length; i++) {
-            if (a[aFromIndex + i] != b[bFromIndex + i])
-                return i;
-        }
-        return -1;
-    }
-
-
-    // Ints
-
-    static int mismatch(int[] a,
-                        int[] b,
-                        int length) {
-        int i = 0;
-        if (length > 1) {
-            i = vectorizedMismatch(
-                    a, Unsafe.ARRAY_INT_BASE_OFFSET,
-                    b, Unsafe.ARRAY_INT_BASE_OFFSET,
-                    length, LOG2_ARRAY_INT_INDEX_SCALE);
-            if (i >= 0)
-                return i;
-            i = length - ~i;
-        }
-        for (; i < length; i++) {
-            if (a[i] != b[i])
-                return i;
-        }
-        return -1;
-    }
-
-    static int mismatch(int[] a, int aFromIndex,
-                        int[] b, int bFromIndex,
-                        int length) {
-        int i = 0;
-        if (length > 1) {
-            int aOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
-            int bOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
-            i = vectorizedMismatch(
-                    a, aOffset,
-                    b, bOffset,
-                    length, LOG2_ARRAY_INT_INDEX_SCALE);
-            if (i >= 0)
-                return i;
-            i = length - ~i;
-        }
-        for (; i < length; i++) {
-            if (a[aFromIndex + i] != b[bFromIndex + i])
-                return i;
-        }
-        return -1;
-    }
-
-
-    // Floats
-
-    static int mismatch(float[] a,
-                        float[] b,
-                        int length) {
-        return mismatch(a, 0, b, 0, length);
-    }
-
-    static int mismatch(float[] a, int aFromIndex,
-                        float[] b, int bFromIndex,
-                        int length) {
-        int i = 0;
-        if (length > 1) {
-            int aOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
-            int bOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
-            i = vectorizedMismatch(
-                    a, aOffset,
-                    b, bOffset,
-                    length, LOG2_ARRAY_FLOAT_INDEX_SCALE);
-            // Mismatched
-            if (i >= 0) {
-                // Check if mismatch is not associated with two NaN values
-                if (!Float.isNaN(a[aFromIndex + i]) || !Float.isNaN(b[bFromIndex + i]))
-                    return i;
-
-                // Mismatch on two different NaN values that are normalized to match
-                // Fall back to slow mechanism
-                // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
-                // However, requires that returned value be relative to input ranges
-                i++;
-            }
-            // Matched
-            else {
-                i = length - ~i;
-            }
-        }
-        for (; i < length; i++) {
-            if (Float.floatToIntBits(a[aFromIndex + i]) != Float.floatToIntBits(b[bFromIndex + i]))
-                return i;
-        }
-        return -1;
-    }
-
-    // 64 bit sizes
-
-    // Long
-
-    static int mismatch(long[] a,
-                        long[] b,
-                        int length) {
-        if (length == 0) {
-            return -1;
-        }
-        int i = vectorizedMismatch(
-                a, Unsafe.ARRAY_LONG_BASE_OFFSET,
-                b, Unsafe.ARRAY_LONG_BASE_OFFSET,
-                length, LOG2_ARRAY_LONG_INDEX_SCALE);
-        return i >= 0 ? i : -1;
-    }
-
-    static int mismatch(long[] a, int aFromIndex,
-                        long[] b, int bFromIndex,
-                        int length) {
-        if (length == 0) {
-            return -1;
-        }
-        int aOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
-        int bOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
-        int i = vectorizedMismatch(
-                a, aOffset,
-                b, bOffset,
-                length, LOG2_ARRAY_LONG_INDEX_SCALE);
-        return i >= 0 ? i : -1;
-    }
-
-
-    // Double
-
-    static int mismatch(double[] a,
-                        double[] b,
-                        int length) {
-        return mismatch(a, 0, b, 0, length);
-    }
-
-    static int mismatch(double[] a, int aFromIndex,
-                        double[] b, int bFromIndex,
-                        int length) {
-        if (length == 0) {
-            return -1;
-        }
-        int aOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
-        int bOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
-        int i = vectorizedMismatch(
-                a, aOffset,
-                b, bOffset,
-                length, LOG2_ARRAY_DOUBLE_INDEX_SCALE);
-        if (i >= 0) {
-            // Check if mismatch is not associated with two NaN values
-            if (!Double.isNaN(a[aFromIndex + i]) || !Double.isNaN(b[bFromIndex + i]))
-                return i;
-
-            // Mismatch on two different NaN values that are normalized to match
-            // Fall back to slow mechanism
-            // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
-            // However, requires that returned value be relative to input ranges
-            i++;
-            for (; i < length; i++) {
-                if (Double.doubleToLongBits(a[aFromIndex + i]) != Double.doubleToLongBits(b[bFromIndex + i]))
-                    return i;
-            }
-        }
-
-        return -1;
-    }
-}
--- a/src/java.base/share/classes/java/util/ResourceBundle.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/util/ResourceBundle.java	Thu Jan 11 10:45:44 2018 +0100
@@ -204,58 +204,70 @@
  * known concrete subclasses {@code ListResourceBundle} and
  * {@code PropertyResourceBundle} are thread-safe.
  *
- * <h3><a id="bundleprovider">Resource Bundles in Named Modules</a></h3>
+ * <h3><a id="resource-bundle-modules">Resource Bundles and Named Modules</a></h3>
  *
- * When resource bundles are deployed in named modules, the following
- * module-specific requirements and restrictions are applied.
+ * Resource bundles can be deployed in modules in the following ways:
  *
- * <ul>
- * <li>Code in a named module that calls {@link #getBundle(String, Locale)}
- * will locate resource bundles in the caller's module (<em>caller module</em>).</li>
- * <li>If resource bundles are deployed in named modules separate from
- * the caller module, those resource bundles need to be loaded from service
- * providers of {@link ResourceBundleProvider}. The caller module must declare
- * "{@code uses}" and the service interface name is the concatenation of the
- * package name of the base name, string "{@code .spi.}", the simple class
- * name of the base name, and the string "{@code Provider}". The
- * <em>bundle provider modules</em> containing resource bundles must
- * declare "{@code provides}" with the service interface name and
- * its implementation class name. For example, if the base name is
- * "{@code com.example.app.MyResources}", the caller module must declare
- * "{@code uses com.example.app.spi.MyResourcesProvider;}" and a module containing resource
- * bundles must declare "{@code provides com.example.app.spi.MyResourcesProvider
- * with com.example.app.internal.MyResourcesProviderImpl;}"
- * where {@code com.example.app.internal.MyResourcesProviderImpl} is an
- * implementation class of {@code com.example.app.spi.MyResourcesProvider}.</li>
- * <li>If you want to use non-standard formats in named modules, such as XML,
- * {@link ResourceBundleProvider} needs to be used.</li>
- * <li>The {@code getBundle} method with a {@code ClassLoader} may not be able to
- * find resource bundles using the given {@code ClassLoader} in named modules.
- * The {@code getBundle} method with a {@code Module} can be used, instead.</li>
- * <li>{@code ResourceBundle.Control} is <em>not</em> supported in named modules.
- * If the {@code getBundle} method with a {@code ResourceBundle.Control} is called
- * in a named module, the method will throw an {@code UnsupportedOperationException}.
- * Any service providers of {@link ResourceBundleControlProvider} are ignored in
- * named modules.
- * </li>
- * </ul>
+ * <h4>Resource bundles together with an application</h4>
  *
- * <h3><a id="RBP_support">ResourceBundleProvider Service Providers</a></h3>
+ * Resource bundles can be deployed together with an application in the same
+ * module.  In that case, the resource bundles are loaded
+ * by code in the module by calling the {@link #getBundle(String)}
+ * or {@link #getBundle(String, Locale)} method.
  *
- * The {@code getBundle} factory methods load service providers of
- * {@link ResourceBundleProvider}, if available, using {@link ServiceLoader}.
- * The service type is designated by
- * {@code <package name> + ".spi." + <simple name> + "Provider"}. For
- * example, if the base name is "{@code com.example.app.MyResources}", the service
- * type is {@code com.example.app.spi.MyResourcesProvider}.
- * <p>
- * In named modules, the loaded service providers for the given base name are
- * used to load resource bundles. If no service provider is available, or if
- * none of the service providers returns a resource bundle and the caller module
- * doesn't have its own service provider, the {@code getBundle} factory method
- * searches for resource bundles that are local in the caller module and that
- * are visible to the class loader of the caller module.  The resource bundle
- * formats for local module searching are "java.class" and "java.properties".
+ * <h4><a id="service-providers">Resource bundles as service providers</a></h4>
+ *
+ * Resource bundles can be deployed in one or more <em>service provider modules</em>
+ * and they can be located using {@link ServiceLoader}.
+ * A {@linkplain ResourceBundleProvider service} interface or class must be
+ * defined. The caller module declares that it uses the service, the service
+ * provider modules declare that they provide implementations of the service.
+ * Refer to {@link ResourceBundleProvider} for developing resource bundle
+ * services and deploying resource bundle providers.
+ * The module obtaining the resource bundle can be a resource bundle
+ * provider itself; in which case this module only locates the resource bundle
+ * via service provider mechanism.
+ *
+ * <p>A {@linkplain ResourceBundleProvider resource bundle provider} can
+ * provide resource bundles in any format such XML which replaces the need
+ * of {@link Control ResourceBundle.Control}.
+ *
+ * <h4><a id="other-modules">Resource bundles in other modules and class path</a></h4>
+ *
+ * Resource bundles in a named module may be <em>encapsulated</em> so that
+ * it cannot be located by code in other modules.  Resource bundles
+ * in unnamed modules and class path are open for any module to access.
+ * Resource bundle follows the resource encapsulation rules as specified
+ * in {@link Module#getResourceAsStream(String)}.
+ *
+ * <p>The {@code getBundle} factory methods with no {@code Control} parameter
+ * locate and load resource bundles from
+ * {@linkplain ResourceBundleProvider service providers}.
+ * It may continue the search as if calling {@link Module#getResourceAsStream(String)}
+ * to find the named resource from a given module and calling
+ * {@link ClassLoader#getResourceAsStream(String)}; refer to
+ * the specification of the {@code getBundle} method for details.
+ * Only non-encapsulated resource bundles of "{@code java.class}"
+ * or "{@code java.properties}" format are searched.
+ *
+ * <p>If the caller module is a
+ * <a href="{@docRoot}/java/util/spi/ResourceBundleProvider.html#obtain-resource-bundle">
+ * resource bundle provider</a>, it does not fall back to the
+ * class loader search.
+ *
+ * <h4>Resource bundles in automatic modules</h4>
+ *
+ * A common format of resource bundles is in {@linkplain PropertyResourceBundle
+ * .properties} file format.  Typically {@code .properties} resource bundles
+ * are packaged in a JAR file.  Resource bundle only JAR file can be readily
+ * deployed as an <a href="{@docRoot}/java/lang/module/ModuleFinder.html#automatic-modules">
+ * automatic module</a>.  For example, if the JAR file contains the
+ * entry "{@code p/q/Foo_ja.properties}" and no {@code .class} entry,
+ * when resolved and defined as an automatic module, no package is derived
+ * for this module.  This allows resource bundles in {@code .properties}
+ * format packaged in one or more JAR files that may contain entries
+ * in the same directory and can be resolved successfully as
+ * automatic modules.
  *
  * <h3>ResourceBundle.Control</h3>
  *
@@ -268,6 +280,14 @@
  * {@link #getBundle(String, Locale, ClassLoader, Control) getBundle}
  * factory method for details.
  *
+ * <p> {@link ResourceBundle.Control} is designed for an application deployed
+ * in an unnamed module, for example to support resource bundles in
+ * non-standard formats or package localized resources in a non-traditional
+ * convention. {@link ResourceBundleProvider} is the replacement for
+ * {@code ResourceBundle.Control} when migrating to modules.
+ * {@code UnsupportedOperationException} will be thrown when a factory
+ * method that takes the {@code ResourceBundle.Control} parameter is called.
+ *
  * <p><a id="modify_default_behavior">For the {@code getBundle} factory</a>
  * methods that take no {@link Control} instance, their <a
  * href="#default_behavior"> default behavior</a> of resource bundle loading
@@ -815,14 +835,10 @@
 
     /**
      * Gets a resource bundle using the specified base name, the default locale,
-     * and the caller's class loader. Calling this method is equivalent to calling
+     * and the caller module. Calling this method is equivalent to calling
      * <blockquote>
-     * <code>getBundle(baseName, Locale.getDefault(), this.getClass().getClassLoader())</code>,
+     * <code>getBundle(baseName, Locale.getDefault(), callerModule)</code>,
      * </blockquote>
-     * except that <code>getClassLoader()</code> is run with the security
-     * privileges of <code>ResourceBundle</code>.
-     * See {@link #getBundle(String, Locale, ClassLoader) getBundle}
-     * for a complete description of the search and instantiation strategy.
      *
      * @param baseName the base name of the resource bundle, a fully qualified class name
      * @exception java.lang.NullPointerException
@@ -830,6 +846,9 @@
      * @exception MissingResourceException
      *     if no resource bundle for the specified base name can be found
      * @return a resource bundle for the given base name and the default locale
+     *
+     * @see <a href="#default_behavior">Resource Bundle Search and Loading Strategy</a>
+     * @see <a href="#resource-bundle-modules">Resource Bundles and Named Modules</a>
      */
     @CallerSensitive
     public static final ResourceBundle getBundle(String baseName)
@@ -887,14 +906,10 @@
 
     /**
      * Gets a resource bundle using the specified base name and locale,
-     * and the caller's class loader. Calling this method is equivalent to calling
+     * and the caller module. Calling this method is equivalent to calling
      * <blockquote>
-     * <code>getBundle(baseName, locale, this.getClass().getClassLoader())</code>,
+     * <code>getBundle(baseName, locale, callerModule)</code>,
      * </blockquote>
-     * except that <code>getClassLoader()</code> is run with the security
-     * privileges of <code>ResourceBundle</code>.
-     * See {@link #getBundle(String, Locale, ClassLoader) getBundle}
-     * for a complete description of the search and instantiation strategy.
      *
      * @param baseName
      *        the base name of the resource bundle, a fully qualified class name
@@ -905,6 +920,9 @@
      * @exception MissingResourceException
      *        if no resource bundle for the specified base name can be found
      * @return a resource bundle for the given base name and locale
+     *
+     * @see <a href="#default_behavior">Resource Bundle Search and Loading Strategy</a>
+     * @see <a href="#resource-bundle-modules">Resource Bundles and Named Modules</a>
      */
     @CallerSensitive
     public static final ResourceBundle getBundle(String baseName,
@@ -922,19 +940,6 @@
      * <code>getBundle(baseName, Locale.getDefault(), module)</code>
      * </blockquote>
      *
-     * <p> Resource bundles in named modules may be encapsulated.  When
-     * the resource bundle is loaded from a provider, the caller module
-     * must have an appropriate <i>uses</i> clause in its <i>module descriptor</i>
-     * to declare that the module uses implementations of
-     * {@code <package name> + ".spi." + <simple name> + "Provider"}.
-     * Otherwise, it will load the resource bundles that are local in the
-     * given module or that are visible to the class loader of the given module
-     * (refer to the <a href="#bundleprovider">Resource Bundles in Named Modules</a>
-     * section for details).
-     * When the resource bundle is loaded from the specified module, it is
-     * subject to the encapsulation rules specified by
-     * {@link Module#getResourceAsStream Module.getResourceAsStream}.
-     *
      * @param baseName the base name of the resource bundle,
      *                 a fully qualified class name
      * @param module   the module for which the resource bundle is searched
@@ -950,6 +955,8 @@
      * @since 9
      * @spec JPMS
      * @see ResourceBundleProvider
+     * @see <a href="#default_behavior">Resource Bundle Search and Loading Strategy</a>
+     * @see <a href="#resource-bundle-modules">Resource Bundles and Named Modules</a>
      */
     @CallerSensitive
     public static ResourceBundle getBundle(String baseName, Module module) {
@@ -963,14 +970,15 @@
      * on behalf of the specified module.
      *
      * <p> Resource bundles in named modules may be encapsulated.  When
-     * the resource bundle is loaded from a provider, the caller module
+     * the resource bundle is loaded from a
+     * {@linkplain ResourceBundleProvider service provider}, the caller module
      * must have an appropriate <i>uses</i> clause in its <i>module descriptor</i>
-     * to declare that the module uses implementations of
-     * {@code <package name> + ".spi." + <simple name> + "Provider"}.
+     * to declare that the module uses of {@link ResourceBundleProvider}
+     * for the named resource bundle.
      * Otherwise, it will load the resource bundles that are local in the
-     * given module or that are visible to the class loader of the given module
-     * (refer to the <a href="#bundleprovider">Resource Bundles in Named Modules</a>
-     * section for details).
+     * given module as if calling {@link Module#getResourceAsStream(String)}
+     * or that are visible to the class loader of the given module
+     * as if calling {@link ClassLoader#getResourceAsStream(String)}.
      * When the resource bundle is loaded from the specified module, it is
      * subject to the encapsulation rules specified by
      * {@link Module#getResourceAsStream Module.getResourceAsStream}.
@@ -1000,6 +1008,8 @@
      * @return a resource bundle for the given base name and locale in the module
      * @since 9
      * @spec JPMS
+     * @see <a href="#default_behavior">Resource Bundle Search and Loading Strategy</a>
+     * @see <a href="#resource-bundle-modules">Resource Bundles and Named Modules</a>
      */
     @CallerSensitive
     public static ResourceBundle getBundle(String baseName, Locale targetLocale, Module module) {
@@ -1060,28 +1070,25 @@
      * Gets a resource bundle using the specified base name, locale, and class
      * loader.
      *
-     * <p>This method behaves the same as calling
-     * {@link #getBundle(String, Locale, ClassLoader, Control)} passing a
-     * default instance of {@link Control} unless another {@link Control} is
-     * provided with the {@link ResourceBundleControlProvider} SPI. Refer to the
+     * <p>When this method is called from a named module and the given
+     * loader is the class loader of the caller module, this is equivalent
+     * to calling:
+     * <blockquote><pre>
+     * getBundle(baseName, targetLocale, callerModule)
+     * </pre></blockquote>
+     *
+     * otherwise, this is equivalent to calling:
+     * <blockquote><pre>
+     * getBundle(baseName, targetLocale, loader, control)
+     * </pre></blockquote>
+     * where {@code control} is the default instance of {@link Control} unless
+     * a {@code Control} instance is provided by
+     * {@link ResourceBundleControlProvider} SPI.  Refer to the
      * description of <a href="#modify_default_behavior">modifying the default
-     * behavior</a>.
-     *
-     * <p><a id="default_behavior">The following describes the default
-     * behavior</a>.
+     * behavior</a>. The following describes the default behavior.
      *
      * <p>
-     * Resource bundles in a named module are private to that module.  If
-     * the caller is in a named module, this method will find resource bundles
-     * from the service providers of {@link java.util.spi.ResourceBundleProvider}
-     * if any. Otherwise, it will load the resource bundles that are visible to
-     * the given {@code loader} (refer to the
-     * <a href="#bundleprovider">Resource Bundles in Named Modules</a> section
-     * for details).
-     * If the caller is in a named module and the given {@code loader} is
-     * different than the caller's class loader, or if the caller is not in
-     * a named module, this method will not find resource bundles from named
-     * modules.
+     * <b><a id="default_behavior">Resource Bundle Search and Loading Strategy</a></b>
      *
      * <p><code>getBundle</code> uses the base name, the specified locale, and
      * the default locale (obtained from {@link java.util.Locale#getDefault()
@@ -1201,7 +1208,7 @@
      *
      * <p><b>Note:</b>The <code>baseName</code> argument should be a fully
      * qualified class name. However, for compatibility with earlier versions,
-     * Sun's Java SE Runtime Environments do not verify this, and so it is
+     * Java SE Runtime Environments do not verify this, and so it is
      * possible to access <code>PropertyResourceBundle</code>s by specifying a
      * path name (using "/") instead of a fully qualified class name (using
      * ".").
@@ -1248,7 +1255,7 @@
      *
      * @apiNote If the caller module is a named module and the given
      * {@code loader} is the caller module's class loader, this method is
-     * equivalent to {@code getBundle(baseName, locale)}; otherwise, it will not
+     * equivalent to {@code getBundle(baseName, locale)}; otherwise, it may not
      * find resource bundles from named modules.
      * Use {@link #getBundle(String, Locale, Module)} to load resource bundles
      * on behalf on a specific module instead.
@@ -1264,6 +1271,7 @@
      * @since 1.2
      * @revised 9
      * @spec JPMS
+     * @see <a href="#resource-bundle-modules">Resource Bundles and Named Modules</a>
      */
     @CallerSensitive
     public static ResourceBundle getBundle(String baseName, Locale locale,
@@ -1278,9 +1286,9 @@
 
     /**
      * Returns a resource bundle using the specified base name, target
-     * locale, class loader and control. Unlike the {@linkplain
-     * #getBundle(String, Locale, ClassLoader) <code>getBundle</code>
-     * factory methods with no <code>control</code> argument}, the given
+     * locale, class loader and control. Unlike the {@link
+     * #getBundle(String, Locale, ClassLoader) getBundle}
+     * factory methods with no {@code control} argument, the given
      * <code>control</code> specifies how to locate and instantiate resource
      * bundles. Conceptually, the bundle loading process with the given
      * <code>control</code> is performed in the following steps.
@@ -2365,7 +2373,14 @@
      * the callback methods provides the information necessary for the
      * factory methods to perform the <a
      * href="./ResourceBundle.html#default_behavior">default behavior</a>.
-     * <a href="#note">Note that this class is not supported in named modules.</a>
+     *
+     * <p> {@link ResourceBundle.Control} is designed for an application deployed
+     * in an unnamed module, for example to support resource bundles in
+     * non-standard formats or package localized resources in a non-traditional
+     * convention. {@link ResourceBundleProvider} is the replacement for
+     * {@code ResourceBundle.Control} when migrating to modules.
+     * {@code UnsupportedOperationException} will be thrown when a factory
+     * method that takes the {@code ResourceBundle.Control} parameter is called.
      *
      * <p>In addition to the callback methods, the {@link
      * #toBundleName(String, Locale) toBundleName} and {@link
@@ -2501,8 +2516,8 @@
      * }
      * </pre>
      *
-     * @apiNote <a id="note">{@code ResourceBundle.Control} is not supported
-     * in named modules.</a> If the {@code ResourceBundle.getBundle} method with
+     * @apiNote {@code ResourceBundle.Control} is not supported
+     * in named modules. If the {@code ResourceBundle.getBundle} method with
      * a {@code ResourceBundle.Control} is called in a named module, the method
      * will throw an {@link UnsupportedOperationException}. Any service providers
      * of {@link ResourceBundleControlProvider} are ignored in named modules.
--- a/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java	Thu Jan 11 10:45:44 2018 +0100
@@ -45,42 +45,46 @@
  *
  * <p>
  * Resource bundles can be packaged in one or more
- * named modules, <em>bundle modules</em>.  The <em>consumer</em> of the
+ * named modules, <em>service provider modules</em>.  The <em>consumer</em> of the
  * resource bundle is the one calling {@link ResourceBundle#getBundle(String)}.
  * In order for the consumer module to load a resource bundle
  * "{@code com.example.app.MyResources}" provided by another module,
  * it will use the {@linkplain java.util.ServiceLoader service loader}
- * mechanism.  A service interface named "{@code com.example.app.MyResourcesProvider}"
- * must be defined and a <em>bundle provider module</em> will provide an
- * implementation class of "{@code com.example.app.MyResourcesProvider}"
+ * mechanism.  A service interface named "{@code com.example.app.spi.MyResourcesProvider}"
+ * must be defined and a <em>service provider module</em> will provide an
+ * implementation class of "{@code com.example.app.spi.MyResourcesProvider}"
  * as follows:
  *
- * <pre><code>
- * import com.example.app.MyResourcesProvider;
+ * <blockquote><pre>
+ * {@code import com.example.app.spi.MyResourcesProvider;
  * class MyResourcesProviderImpl extends AbstractResourceBundleProvider
  *     implements MyResourcesProvider
  * {
+ *     public MyResourcesProviderImpl() {
+ *         super("java.properties");
+ *     }
+ *     // this provider maps the resource bundle to per-language package
  *     protected String toBundleName(String baseName, Locale locale) {
- *         // return the bundle name per the naming of the resource bundle
- *         :
+ *         return "p." + locale.getLanguage() + "." + baseName;
  *     }
  *
  *     public ResourceBundle getBundle(String baseName, Locale locale) {
- *         // this module only provides bundles in french
+ *         // this module only provides bundles in French
  *         if (locale.equals(Locale.FRENCH)) {
  *              return super.getBundle(baseName, locale);
  *         }
+ *         // otherwise return null
  *         return null;
  *     }
- * }</code></pre>
+ * }}</pre></blockquote>
  *
- * @see <a href="../ResourceBundle.html#bundleprovider">
- *     Resource Bundles in Named Modules</a>
- * @see <a href="../ResourceBundle.html#RBP_support">
- *     ResourceBundleProvider Service Providers</a>
+ * Refer to {@link ResourceBundleProvider} for details.
  *
+ * @see <a href="../ResourceBundle.html#resource-bundle-modules">
+ *      Resource Bundles and Named Modules</a>
  * @since 9
  * @spec JPMS
+
  */
 public abstract class AbstractResourceBundleProvider implements ResourceBundleProvider {
     private static final JavaUtilResourceBundleAccess RB_ACCESS =
--- a/src/java.base/share/classes/java/util/spi/ResourceBundleProvider.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/util/spi/ResourceBundleProvider.java	Thu Jan 11 10:45:44 2018 +0100
@@ -29,33 +29,117 @@
 import java.util.ResourceBundle;
 
 /**
- * {@code ResourceBundleProvider} is a provider interface that is used for
- * loading resource bundles for named modules. Implementation classes of
- * this interface are loaded with {@link java.util.ServiceLoader ServiceLoader}
- * during a call to the
- * {@link ResourceBundle#getBundle(String, Locale, ClassLoader)
- * ResourceBundle.getBundle} method. The provider service type is determined by
- * {@code <package name> + ".spi." + <simple name> + "Provider"}.
+ * {@code ResourceBundleProvider} is a service provider interface for
+ * resource bundles. It is used by
+ * {@link ResourceBundle#getBundle(String) ResourceBundle.getBundle}
+ * factory methods to locate and load the service providers that are deployed as
+ * modules via {@link java.util.ServiceLoader ServiceLoader}.
  *
- * <p>
- * For example, if the base name is "com.example.app.MyResources",
- * {@code com.example.app.spi.MyResourcesProvider} will be the provider service type:
- * <pre>{@code
+ * <h3>Developing resource bundle services</h3>
+ *
+ * A service for a resource bundle of a given <em>{@code baseName}</em> must have
+ * a fully-qualified class name of the form:
+ * <blockquote>
+ * {@code <package of baseName> + ".spi." + <simple name of baseName> + "Provider"}
+ * </blockquote>
+ *
+ * The service type is in a {@code spi} subpackage as it may be packaged in
+ * a module separate from the resource bundle providers.
+ * For example, the service for a resource bundle named
+ * {@code com.example.app.MyResources} must be
+ * {@code com.example.app.spi.MyResourcesProvider}:
+ *
+ * <blockquote><pre>
+ * {@code package com.example.app.spi;
  * public interface MyResourcesProvider extends ResourceBundleProvider {
  * }
- * }</pre>
+ * }</pre></blockquote>
  *
- * <p>
- * This providers's {@link #getBundle(String, Locale) getBundle} method is called
- * through the resource bundle loading process instead of {@link
- * java.util.ResourceBundle.Control#newBundle(String, Locale, String, ClassLoader, boolean)
- * ResourceBundle.Control.newBundle()}. Refer to {@link ResourceBundle} for
- * details.
+ * <h3>Deploying resource bundle service providers</h3>
  *
- * @see <a href="../ResourceBundle.html#bundleprovider">
- *     Resource Bundles in Named Modules</a>
- * @see <a href="../ResourceBundle.html#RBP_support">
- *     ResourceBundleProvider Service Providers</a>
+ * Resource bundles can be deployed in one or more service providers
+ * in modules.  For example, a provider for a service
+ * named "{@code com.example.app.spi.MyResourcesProvider}"
+ * has the following implementation class:
+ *
+ * <blockquote><pre>
+ * {@code import com.example.app.spi.MyResourcesProvider;
+ * class MyResourcesProviderImpl extends AbstractResourceBundleProvider
+ *     implements MyResourcesProvider
+ * {
+ *     public MyResourcesProviderImpl() {
+ *         super("java.properties");
+ *     }
+ *     // this provider maps the resource bundle to per-language package
+ *     protected String toBundleName(String baseName, Locale locale) {
+ *         return "p." + locale.getLanguage() + "." + baseName;
+ *     }
+ *
+ *     public ResourceBundle getBundle(String baseName, Locale locale) {
+ *         // this module only provides bundles in French
+ *         if (locale.equals(Locale.FRENCH)) {
+ *              return super.getBundle(baseName, locale);
+ *         }
+ *         // otherwise return null
+ *         return null;
+ *     }
+ * }}</pre></blockquote>
+ *
+ * This example provides "{@code com.example.app.MyResources}"
+ * resource bundle of the French locale.  Traditionally resource bundles of
+ * all locales are packaged in the same package as the resource bundle base name.
+ * When deploying resource bundles in more than one modules and two modules
+ * containing a package of the same name, <em>split package</em>,
+ * is not supported, resource bundles in each module can be packaged in
+ * a different package as shown in this example where this provider packages
+ * the resource bundles in per-language package, i.e. {@code com.example.app.fr}
+ * for French locale.
+ *
+ * <p> A provider can provide more than one services, each of which is a service
+ * for a resource bundle of a different base name.
+ *
+ * <p>{@link AbstractResourceBundleProvider}
+ * provides the basic implementation for {@code ResourceBundleProvider}
+ * and a subclass can override the {@link
+ * AbstractResourceBundleProvider#toBundleName(String, Locale) toBundleName}
+ * method to return a provider-specific location of the resource to be loaded,
+ * for example, per-language package.
+ * A provider can override {@link #getBundle ResourceBundleProvider.getBundle}
+ * method for example to only search the known supported locales or
+ * return resource bundles in other formats such as XML.
+ *
+ * <p>The module declaration of this provider module specifies the following
+ * directive:
+ * <pre>
+ *     provides com.example.app.spi.MyResourcesProvider with com.example.impl.MyResourcesProviderImpl;
+ * </pre>
+ *
+ * <h3><a id="obtain-resource-bundle">Obtaining resource bundles from providers</a></h3>
+ *
+ * The module declaration of the <em>consumer module</em> that calls one of the
+ * {@code ResourceBundle.getBundle} factory methods to obtain a resource
+ * bundle from service providers must specify the following directive:
+ * <pre>
+ *     uses com.example.app.spi.MyResourcesProvider;
+ * </pre>
+ *
+ * {@link ResourceBundle#getBundle(String, Locale)
+ * ResourceBundle.getBundle("com.example.app.MyResource", locale)}
+ * locates and loads the providers for {@code com.example.app.spi.MyResourcesProvider}
+ * service and then invokes {@link #getBundle(String, Locale)
+ * ResourceBundleProvider.getBundle("com.example.app.MyResource", locale)} to
+ * find the resource bundle of the given base name and locale.
+ * If the consumer module is a resource bundle service provider for
+ * {@code com.example.app.spi.MyResourcesProvider}, {@code ResourceBundle.getBundle}
+ * will locate resource bundles only from service providers.
+ * Otherwise, {@code ResourceBundle.getBundle} may continue the search of
+ * the resource bundle in other modules and class path per the specification
+ * of the {@code ResourceBundle.getBundle} method being called.
+ *
+ * @see AbstractResourceBundleProvider
+ * @see <a href="../ResourceBundle.html#resource-bundle-modules">
+ *      Resource Bundles and Named Modules</a>
+ * @see java.util.ServiceLoader
  * @since 9
  * @spec JPMS
  */
--- a/src/java.base/share/classes/java/util/stream/WhileOps.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/java/util/stream/WhileOps.java	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -95,7 +95,7 @@
 
                     @Override
                     public void accept(T t) {
-                        if (take = predicate.test(t)) {
+                        if (take && (take = predicate.test(t))) {
                             downstream.accept(t);
                         }
                     }
@@ -152,7 +152,7 @@
 
                     @Override
                     public void accept(int t) {
-                        if (take = predicate.test(t)) {
+                        if (take && (take = predicate.test(t))) {
                             downstream.accept(t);
                         }
                     }
@@ -209,7 +209,7 @@
 
                     @Override
                     public void accept(long t) {
-                        if (take = predicate.test(t)) {
+                        if (take && (take = predicate.test(t))) {
                             downstream.accept(t);
                         }
                     }
@@ -266,7 +266,7 @@
 
                     @Override
                     public void accept(double t) {
-                        if (take = predicate.test(t)) {
+                        if (take && (take = predicate.test(t))) {
                             downstream.accept(t);
                         }
                     }
--- a/src/java.base/share/classes/jdk/internal/loader/AbstractClassLoaderValue.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/jdk/internal/loader/AbstractClassLoaderValue.java	Thu Jan 11 10:45:44 2018 +0100
@@ -4,7 +4,9 @@
  *
  * 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.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
--- a/src/java.base/share/classes/jdk/internal/loader/ClassLoaderValue.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/jdk/internal/loader/ClassLoaderValue.java	Thu Jan 11 10:45:44 2018 +0100
@@ -4,7 +4,9 @@
  *
  * 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.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
--- a/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java	Thu Jan 11 10:45:44 2018 +0100
@@ -64,7 +64,7 @@
 public final class ModuleInfo {
 
     private final int JAVA_MIN_SUPPORTED_VERSION = 53;
-    private final int JAVA_MAX_SUPPORTED_VERSION = 54;
+    private final int JAVA_MAX_SUPPORTED_VERSION = 55;
 
     private static final JavaLangModuleAccess JLMA
         = SharedSecrets.getJavaLangModuleAccess();
--- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java	Thu Jan 11 10:45:44 2018 +0100
@@ -185,7 +185,7 @@
     public ClassReader(final byte[] b, final int off, final int len) {
         this.b = b;
         // checks the class version
-        if (readShort(off + 6) > Opcodes.V10) {
+        if (readShort(off + 6) > Opcodes.V11) {
             throw new IllegalArgumentException();
         }
         // parses the constant pool
--- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java	Thu Jan 11 10:45:44 2018 +0100
@@ -90,6 +90,7 @@
     int V1_8 = 0 << 16 | 52;
     int V9 = 0 << 16 | 53;
     int V10 = 0 << 16 | 54;
+    int V11 = 0 << 16 | 55;
 
     // access flags
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/util/ArraysSupport.java	Thu Jan 11 10:45:44 2018 +0100
@@ -0,0 +1,545 @@
+/*
+ * Copyright (c) 2015, 2017 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package jdk.internal.util;
+
+import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.Unsafe;
+
+/**
+ * Utility methods to find a mismatch between two primitive arrays.
+ *
+ * <p>Array equality and lexicographical comparison can be built on top of
+ * array mismatch functionality.
+ *
+ * <p>The mismatch method implementation, {@link #vectorizedMismatch}, leverages
+ * vector-based techniques to access and compare the contents of two arrays.
+ * The Java implementation uses {@code Unsafe.getLongUnaligned} to access the
+ * content of an array, thus access is supported on platforms that do not
+ * support unaligned access.  For a byte[] array, 8 bytes (64 bits) can be
+ * accessed and compared as a unit rather than individually, which increases
+ * the performance when the method is compiled by the HotSpot VM.  On supported
+ * platforms the mismatch implementation is intrinsified to leverage SIMD
+ * instructions.  So for a byte[] array, 16 bytes (128 bits), 32 bytes
+ * (256 bits), and perhaps in the future even 64 bytes (512 bits), platform
+ * permitting, can be accessed and compared as a unit, which further increases
+ * the performance over the Java implementation.
+ *
+ * <p>None of the mismatch methods perform array bounds checks.  It is the
+ * responsibility of the caller (direct or otherwise) to perform such checks
+ * before calling this method.
+ */
+public class ArraysSupport {
+    static final Unsafe U = Unsafe.getUnsafe();
+
+    private static final boolean BIG_ENDIAN = U.isBigEndian();
+
+    public static final int LOG2_ARRAY_BOOLEAN_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
+    public static final int LOG2_ARRAY_BYTE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BYTE_INDEX_SCALE);
+    public static final int LOG2_ARRAY_CHAR_INDEX_SCALE = exactLog2(Unsafe.ARRAY_CHAR_INDEX_SCALE);
+    public static final int LOG2_ARRAY_SHORT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_SHORT_INDEX_SCALE);
+    public static final int LOG2_ARRAY_INT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_INT_INDEX_SCALE);
+    public static final int LOG2_ARRAY_LONG_INDEX_SCALE = exactLog2(Unsafe.ARRAY_LONG_INDEX_SCALE);
+    public static final int LOG2_ARRAY_FLOAT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_FLOAT_INDEX_SCALE);
+    public static final int LOG2_ARRAY_DOUBLE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_DOUBLE_INDEX_SCALE);
+
+    private static final int LOG2_BYTE_BIT_SIZE = exactLog2(Byte.SIZE);
+
+    private static int exactLog2(int scale) {
+        if ((scale & (scale - 1)) != 0)
+            throw new Error("data type scale not a power of two");
+        return Integer.numberOfTrailingZeros(scale);
+    }
+
+    private ArraysSupport() {}
+
+    /**
+     * Find the relative index of the first mismatching pair of elements in two
+     * primitive arrays of the same component type.  Pairs of elements will be
+     * tested in order relative to given offsets into both arrays.
+     *
+     * <p>This method does not perform type checks or bounds checks.  It is the
+     * responsibility of the caller to perform such checks before calling this
+     * method.
+     *
+     * <p>The given offsets, in bytes, need not be aligned according to the
+     * given log<sub>2</sub> size the array elements.  More specifically, an
+     * offset modulus the size need not be zero.
+     *
+     * @param a the first array to be tested for mismatch, or {@code null} for
+     * direct memory access
+     * @param aOffset the relative offset, in bytes, from the base address of
+     * the first array to test from, otherwise if the first array is
+     * {@code null}, an absolute address pointing to the first element to test.
+     * @param b the second array to be tested for mismatch, or {@code null} for
+     * direct memory access
+     * @param bOffset the relative offset, in bytes, from the base address of
+     * the second array to test from, otherwise if the second array is
+     * {@code null}, an absolute address pointing to the first element to test.
+     * @param length the number of array elements to test
+     * @param log2ArrayIndexScale log<sub>2</sub> of the array index scale, that
+     * corresponds to the size, in bytes, of an array element.
+     * @return if a mismatch is found a relative index, between 0 (inclusive)
+     * and {@code length} (exclusive), of the first mismatching pair of elements
+     * in the two arrays.  Otherwise, if a mismatch is not found the bitwise
+     * compliment of the number of remaining pairs of elements to be checked in
+     * the tail of the two arrays.
+     */
+    @HotSpotIntrinsicCandidate
+    public static int vectorizedMismatch(Object a, long aOffset,
+                                         Object b, long bOffset,
+                                         int length,
+                                         int log2ArrayIndexScale) {
+        // assert a.getClass().isArray();
+        // assert b.getClass().isArray();
+        // assert 0 <= length <= sizeOf(a)
+        // assert 0 <= length <= sizeOf(b)
+        // assert 0 <= log2ArrayIndexScale <= 3
+
+        int log2ValuesPerWidth = LOG2_ARRAY_LONG_INDEX_SCALE - log2ArrayIndexScale;
+        int wi = 0;
+        for (; wi < length >> log2ValuesPerWidth; wi++) {
+            long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
+            long av = U.getLongUnaligned(a, aOffset + bi);
+            long bv = U.getLongUnaligned(b, bOffset + bi);
+            if (av != bv) {
+                long x = av ^ bv;
+                int o = BIG_ENDIAN
+                        ? Long.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
+                        : Long.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
+                return (wi << log2ValuesPerWidth) + o;
+            }
+        }
+
+        // Calculate the tail of remaining elements to check
+        int tail = length - (wi << log2ValuesPerWidth);
+
+        if (log2ArrayIndexScale < LOG2_ARRAY_INT_INDEX_SCALE) {
+            int wordTail = 1 << (LOG2_ARRAY_INT_INDEX_SCALE - log2ArrayIndexScale);
+            // Handle 4 bytes or 2 chars in the tail using int width
+            if (tail >= wordTail) {
+                long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
+                int av = U.getIntUnaligned(a, aOffset + bi);
+                int bv = U.getIntUnaligned(b, bOffset + bi);
+                if (av != bv) {
+                    int x = av ^ bv;
+                    int o = BIG_ENDIAN
+                            ? Integer.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
+                            : Integer.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
+                    return (wi << log2ValuesPerWidth) + o;
+                }
+                tail -= wordTail;
+            }
+            return ~tail;
+        }
+        else {
+            return ~tail;
+        }
+    }
+
+    // Booleans
+    // Each boolean element takes up one byte
+
+    public static int mismatch(boolean[] a,
+                               boolean[] b,
+                               int length) {
+        int i = 0;
+        if (length > 7) {
+            i = vectorizedMismatch(
+                    a, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+                    b, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+                    length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[i] != b[i])
+                return i;
+        }
+        return -1;
+    }
+
+    public static int mismatch(boolean[] a, int aFromIndex,
+                               boolean[] b, int bFromIndex,
+                               int length) {
+        int i = 0;
+        if (length > 7) {
+            int aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
+            int bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
+            i = vectorizedMismatch(
+                    a, aOffset,
+                    b, bOffset,
+                    length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[aFromIndex + i] != b[bFromIndex + i])
+                return i;
+        }
+        return -1;
+    }
+
+
+    // Bytes
+
+    /**
+     * Find the index of a mismatch between two arrays.
+     *
+     * <p>This method does not perform bounds checks. It is the responsibility
+     * of the caller to perform such bounds checks before calling this method.
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param b the second array to be tested for a mismatch
+     * @param length the number of bytes from each array to check
+     * @return the index of a mismatch between the two arrays, otherwise -1 if
+     * no mismatch.  The index will be within the range of (inclusive) 0 to
+     * (exclusive) the smaller of the two array lengths.
+     */
+    public static int mismatch(byte[] a,
+                               byte[] b,
+                               int length) {
+        // ISSUE: defer to index receiving methods if performance is good
+        // assert length <= a.length
+        // assert length <= b.length
+
+        int i = 0;
+        if (length > 7) {
+            i = vectorizedMismatch(
+                    a, Unsafe.ARRAY_BYTE_BASE_OFFSET,
+                    b, Unsafe.ARRAY_BYTE_BASE_OFFSET,
+                    length, LOG2_ARRAY_BYTE_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            // Align to tail
+            i = length - ~i;
+//            assert i >= 0 && i <= 7;
+        }
+        // Tail < 8 bytes
+        for (; i < length; i++) {
+            if (a[i] != b[i])
+                return i;
+        }
+        return -1;
+    }
+
+    /**
+     * Find the relative index of a mismatch between two arrays starting from
+     * given indexes.
+     *
+     * <p>This method does not perform bounds checks. It is the responsibility
+     * of the caller to perform such bounds checks before calling this method.
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param aFromIndex the index of the first element (inclusive) in the first
+     * array to be compared
+     * @param b the second array to be tested for a mismatch
+     * @param bFromIndex the index of the first element (inclusive) in the
+     * second array to be compared
+     * @param length the number of bytes from each array to check
+     * @return the relative index of a mismatch between the two arrays,
+     * otherwise -1 if no mismatch.  The index will be within the range of
+     * (inclusive) 0 to (exclusive) the smaller of the two array bounds.
+     */
+    public static int mismatch(byte[] a, int aFromIndex,
+                               byte[] b, int bFromIndex,
+                               int length) {
+        // assert 0 <= aFromIndex < a.length
+        // assert 0 <= aFromIndex + length <= a.length
+        // assert 0 <= bFromIndex < b.length
+        // assert 0 <= bFromIndex + length <= b.length
+        // assert length >= 0
+
+        int i = 0;
+        if (length > 7) {
+            int aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
+            int bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
+            i = vectorizedMismatch(
+                    a, aOffset,
+                    b, bOffset,
+                    length, LOG2_ARRAY_BYTE_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[aFromIndex + i] != b[bFromIndex + i])
+                return i;
+        }
+        return -1;
+    }
+
+
+    // Chars
+
+    public static int mismatch(char[] a,
+                               char[] b,
+                               int length) {
+        int i = 0;
+        if (length > 3) {
+            i = vectorizedMismatch(
+                    a, Unsafe.ARRAY_CHAR_BASE_OFFSET,
+                    b, Unsafe.ARRAY_CHAR_BASE_OFFSET,
+                    length, LOG2_ARRAY_CHAR_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[i] != b[i])
+                return i;
+        }
+        return -1;
+    }
+
+    public static int mismatch(char[] a, int aFromIndex,
+                               char[] b, int bFromIndex,
+                               int length) {
+        int i = 0;
+        if (length > 3) {
+            int aOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
+            int bOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
+            i = vectorizedMismatch(
+                    a, aOffset,
+                    b, bOffset,
+                    length, LOG2_ARRAY_CHAR_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[aFromIndex + i] != b[bFromIndex + i])
+                return i;
+        }
+        return -1;
+    }
+
+
+    // Shorts
+
+    public static int mismatch(short[] a,
+                               short[] b,
+                               int length) {
+        int i = 0;
+        if (length > 3) {
+            i = vectorizedMismatch(
+                    a, Unsafe.ARRAY_SHORT_BASE_OFFSET,
+                    b, Unsafe.ARRAY_SHORT_BASE_OFFSET,
+                    length, LOG2_ARRAY_SHORT_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[i] != b[i])
+                return i;
+        }
+        return -1;
+    }
+
+    public static int mismatch(short[] a, int aFromIndex,
+                               short[] b, int bFromIndex,
+                               int length) {
+        int i = 0;
+        if (length > 3) {
+            int aOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
+            int bOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
+            i = vectorizedMismatch(
+                    a, aOffset,
+                    b, bOffset,
+                    length, LOG2_ARRAY_SHORT_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[aFromIndex + i] != b[bFromIndex + i])
+                return i;
+        }
+        return -1;
+    }
+
+
+    // Ints
+
+    public static int mismatch(int[] a,
+                               int[] b,
+                               int length) {
+        int i = 0;
+        if (length > 1) {
+            i = vectorizedMismatch(
+                    a, Unsafe.ARRAY_INT_BASE_OFFSET,
+                    b, Unsafe.ARRAY_INT_BASE_OFFSET,
+                    length, LOG2_ARRAY_INT_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[i] != b[i])
+                return i;
+        }
+        return -1;
+    }
+
+    public static int mismatch(int[] a, int aFromIndex,
+                               int[] b, int bFromIndex,
+                               int length) {
+        int i = 0;
+        if (length > 1) {
+            int aOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
+            int bOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
+            i = vectorizedMismatch(
+                    a, aOffset,
+                    b, bOffset,
+                    length, LOG2_ARRAY_INT_INDEX_SCALE);
+            if (i >= 0)
+                return i;
+            i = length - ~i;
+        }
+        for (; i < length; i++) {
+            if (a[aFromIndex + i] != b[bFromIndex + i])
+                return i;
+        }
+        return -1;
+    }
+
+
+    // Floats
+
+    public static int mismatch(float[] a,
+                               float[] b,
+                               int length) {
+        return mismatch(a, 0, b, 0, length);
+    }
+
+    public static int mismatch(float[] a, int aFromIndex,
+                               float[] b, int bFromIndex,
+                               int length) {
+        int i = 0;
+        if (length > 1) {
+            int aOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
+            int bOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
+            i = vectorizedMismatch(
+                    a, aOffset,
+                    b, bOffset,
+                    length, LOG2_ARRAY_FLOAT_INDEX_SCALE);
+            // Mismatched
+            if (i >= 0) {
+                // Check if mismatch is not associated with two NaN values
+                if (!Float.isNaN(a[aFromIndex + i]) || !Float.isNaN(b[bFromIndex + i]))
+                    return i;
+
+                // Mismatch on two different NaN values that are normalized to match
+                // Fall back to slow mechanism
+                // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+                // However, requires that returned value be relative to input ranges
+                i++;
+            }
+            // Matched
+            else {
+                i = length - ~i;
+            }
+        }
+        for (; i < length; i++) {
+            if (Float.floatToIntBits(a[aFromIndex + i]) != Float.floatToIntBits(b[bFromIndex + i]))
+                return i;
+        }
+        return -1;
+    }
+
+    // 64 bit sizes
+
+    // Long
+
+    public static int mismatch(long[] a,
+                               long[] b,
+                               int length) {
+        if (length == 0) {
+            return -1;
+        }
+        int i = vectorizedMismatch(
+                a, Unsafe.ARRAY_LONG_BASE_OFFSET,
+                b, Unsafe.ARRAY_LONG_BASE_OFFSET,
+                length, LOG2_ARRAY_LONG_INDEX_SCALE);
+        return i >= 0 ? i : -1;
+    }
+
+    public static int mismatch(long[] a, int aFromIndex,
+                               long[] b, int bFromIndex,
+                               int length) {
+        if (length == 0) {
+            return -1;
+        }
+        int aOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
+        int bOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
+        int i = vectorizedMismatch(
+                a, aOffset,
+                b, bOffset,
+                length, LOG2_ARRAY_LONG_INDEX_SCALE);
+        return i >= 0 ? i : -1;
+    }
+
+
+    // Double
+
+    public static int mismatch(double[] a,
+                               double[] b,
+                               int length) {
+        return mismatch(a, 0, b, 0, length);
+    }
+
+    public static int mismatch(double[] a, int aFromIndex,
+                               double[] b, int bFromIndex,
+                               int length) {
+        if (length == 0) {
+            return -1;
+        }
+        int aOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+        int bOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+        int i = vectorizedMismatch(
+                a, aOffset,
+                b, bOffset,
+                length, LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+        if (i >= 0) {
+            // Check if mismatch is not associated with two NaN values
+            if (!Double.isNaN(a[aFromIndex + i]) || !Double.isNaN(b[bFromIndex + i]))
+                return i;
+
+            // Mismatch on two different NaN values that are normalized to match
+            // Fall back to slow mechanism
+            // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+            // However, requires that returned value be relative to input ranges
+            i++;
+            for (; i < length; i++) {
+                if (Double.doubleToLongBits(a[aFromIndex + i]) != Double.doubleToLongBits(b[bFromIndex + i]))
+                    return i;
+            }
+        }
+
+        return -1;
+    }
+}
--- a/src/java.base/share/classes/module-info.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/module-info.java	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -141,7 +141,7 @@
         java.instrument,
         java.logging;
     exports jdk.internal.jmod to
-        jdk.compiler,   // reflective dependency
+        jdk.compiler,
         jdk.jlink;
     exports jdk.internal.logger to
         java.logging;
@@ -171,7 +171,7 @@
         java.xml,
         jdk.attach,
         jdk.charsets,
-        jdk.compiler,   // reflective dependency
+        jdk.compiler,
         jdk.incubator.httpclient,
         jdk.jdeps,
         jdk.jlink,
--- a/src/java.base/share/classes/sun/security/ssl/ExtendedMasterSecretExtension.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/sun/security/ssl/ExtendedMasterSecretExtension.java	Thu Jan 11 10:45:44 2018 +0100
@@ -1,11 +1,12 @@
 /*
  * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates.
- *
  * 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.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
--- a/src/java.base/share/classes/sun/security/ssl/HandshakeHash.java	Wed Dec 20 11:57:20 2017 +0100
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeHash.java	Thu Jan 11 10:45:44 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, 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
@@ -108,7 +108,29 @@
      * a hash for the certificate verify message is required.
      */
     HandshakeHash(boolean needCertificateVerify) {
-        clonesNeeded = needCertificateVerify ? 4 : 3;
+        // We may rework the code later, but for now we use hard-coded number
+        // of clones if the underlying MessageDigests are not cloneable.
+        //
+        // The number used here is based on the current handshake protocols and
+        // implementation.  It may be changed if the handshake processe gets
+        // changed in the future, for example adding a new extension that
+        // requires handshake hash.  Please be careful about the number of
+        // clones if additional handshak hash is required in the future.
+        //
+        // For the current implementation, the handshake hash is required for
+        // the following items:
+        //     . CertificateVerify handshake message (optional)
+        //     . client Finished handshake message
+        //     . server Finished Handshake message
+        //     . the extended Master Secret extension [RFC 7627]
+        //
+        // Note that a late call to server setNeedClientAuth dose not update
+        // the number of clones.  We may address the issue later.
+        //
+        // Note for safety, we allocate one more clone for the current
+        // implementation.  We may consider it more carefully in the future
+        // for the exact number or rework the code in a different way.
+        clonesNeeded = needCertificateVerify ? 5 : 4;
     }
 
     void reserve(ByteBuffer input) {
@@ -335,7 +357,8 @@
         if (finMD != null) return;
 
         try {
-            finMD = CloneableDigest.getDigest(normalizeAlgName(s), 2);
+            // See comment in the contructor.
+            finMD = CloneableDigest.getDigest(normalizeAlgName(s), 4);
         } catch (NoSuchAlgorithmException e) {
             throw new Error(e);
         }
--- a/src/java.base/share/native/include/classfile_constants.h	Wed Dec 20 11:57:20 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,584 +0,0 @@
-/*
- * Copyright (c) 2004, 2016, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 CLASSFILE_CONSTANTS_H
-#define CLASSFILE_CONSTANTS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Classfile version number for this information */
-#define JVM_CLASSFILE_MAJOR_VERSION 54
-#define JVM_CLASSFILE_MINOR_VERSION 0
-
-/* Flags */
-
-enum {
-    JVM_ACC_PUBLIC        = 0x0001,
-    JVM_ACC_PRIVATE       = 0x0002,
-    JVM_ACC_PROTECTED     = 0x0004,
-    JVM_ACC_STATIC        = 0x0008,
-    JVM_ACC_FINAL         = 0x0010,
-    JVM_ACC_SYNCHRONIZED  = 0x0020,
-    JVM_ACC_SUPER         = 0x0020,
-    JVM_ACC_VOLATILE      = 0x0040,
-    JVM_ACC_BRIDGE        = 0x0040,
-    JVM_ACC_TRANSIENT     = 0x0080,
-    JVM_ACC_VARARGS       = 0x0080,
-    JVM_ACC_VALUE         = 0x0100,
-    JVM_ACC_NATIVE        = 0x0100,
-    JVM_ACC_INTERFACE     = 0x0200,
-    JVM_ACC_ABSTRACT      = 0x0400,
-    JVM_ACC_STRICT        = 0x0800,
-    JVM_ACC_SYNTHETIC     = 0x1000,
-    JVM_ACC_ANNOTATION    = 0x2000,
-    JVM_ACC_ENUM          = 0x4000,
-    JVM_ACC_MODULE        = 0x8000
-};
-
-#define JVM_ACC_PUBLIC_BIT        0
-#define JVM_ACC_PRIVATE_BIT       1
-#define JVM_ACC_PROTECTED_BIT     2
-#define JVM_ACC_STATIC_BIT        3
-#define JVM_ACC_FINAL_BIT         4
-#define JVM_ACC_SYNCHRONIZED_BIT  5
-#define JVM_ACC_SUPER_BIT         5
-#define JVM_ACC_VOLATILE_BIT      6
-#define JVM_ACC_BRIDGE_BIT        6
-#define JVM_ACC_TRANSIENT_BIT     7
-#define JVM_ACC_VARARGS_BIT       7
-#define JVM_ACC_VALUE_BIT         8
-#define JVM_ACC_NATIVE_BIT        8
-#define JVM_ACC_INTERFACE_BIT     9
-#define JVM_ACC_ABSTRACT_BIT      10
-#define JVM_ACC_STRICT_BIT        11
-#define JVM_ACC_SYNTHETIC_BIT     12
-#define JVM_ACC_ANNOTATION_BIT    13
-#define JVM_ACC_ENUM_BIT          14
-
-/* Used in newarray instruction. */
-
-enum {
-    JVM_T_BOOLEAN = 4,
-    JVM_T_CHAR    = 5,
-    JVM_T_FLOAT   = 6,
-    JVM_T_DOUBLE  = 7,
-    JVM_T_BYTE    = 8,
-    JVM_T_SHORT   = 9,
-    JVM_T_INT     = 10,
-    JVM_T_LONG    = 11
-};
-
-/* Constant Pool Entries */
-
-enum {
-    JVM_CONSTANT_Utf8                   = 1,
-    JVM_CONSTANT_Unicode                = 2, /* unused */
-    JVM_CONSTANT_Integer                = 3,
-    JVM_CONSTANT_Float                  = 4,
-    JVM_CONSTANT_Long                   = 5,
-    JVM_CONSTANT_Double                 = 6,
-    JVM_CONSTANT_Class                  = 7,
-    JVM_CONSTANT_String                 = 8,
-    JVM_CONSTANT_Fieldref               = 9,
-    JVM_CONSTANT_Methodref              = 10,
-    JVM_CONSTANT_InterfaceMethodref     = 11,
-    JVM_CONSTANT_NameAndType            = 12,
-    JVM_CONSTANT_MethodHandle           = 15,  // JSR 292
-    JVM_CONSTANT_MethodType             = 16,  // JSR 292
-    JVM_CONSTANT_InvokeDynamic          = 18,
-    JVM_CONSTANT_ExternalMax            = 18
-};
-
-/* JVM_CONSTANT_MethodHandle subtypes */
-enum {
-    JVM_REF_getField                = 1,
-    JVM_REF_getStatic               = 2,
-    JVM_REF_putField                = 3,
-    JVM_REF_putStatic               = 4,
-    JVM_REF_invokeVirtual           = 5,
-    JVM_REF_invokeStatic            = 6,
-    JVM_REF_invokeSpecial           = 7,
-    JVM_REF_newInvokeSpecial        = 8,
-    JVM_REF_invokeInterface         = 9
-};
-
-/* StackMapTable type item numbers */
-
-enum {
-    JVM_ITEM_Top                = 0,
-    JVM_ITEM_Integer            = 1,
-    JVM_ITEM_Float              = 2,
-    JVM_ITEM_Double             = 3,
-    JVM_ITEM_Long               = 4,
-    JVM_ITEM_Null               = 5,
-    JVM_ITEM_UninitializedThis  = 6,
-    JVM_ITEM_Object             = 7,
-    JVM_ITEM_Uninitialized      = 8
-};
-
-/* Type signatures */
-
-enum {
-    JVM_SIGNATURE_ARRAY         = '[',
-    JVM_SIGNATURE_BYTE          = 'B',
-    JVM_SIGNATURE_CHAR          = 'C',
-    JVM_SIGNATURE_CLASS         = 'L',
-    JVM_SIGNATURE_VALUE_CLASS   = 'Q',
-    JVM_SIGNATURE_ENDCLASS      = ';',
-    JVM_SIGNATURE_ENUM          = 'E',
-    JVM_SIGNATURE_FLOAT         = 'F',
-    JVM_SIGNATURE_DOUBLE        = 'D',
-    JVM_SIGNATURE_FUNC          = '(',
-    JVM_SIGNATURE_ENDFUNC       = ')',
-    JVM_SIGNATURE_INT           = 'I',
-    JVM_SIGNATURE_LONG          = 'J',
-    JVM_SIGNATURE_SHORT         = 'S',
-    JVM_SIGNATURE_VOID          = 'V',
-    JVM_SIGNATURE_BOOLEAN       = 'Z'
-};
-
-/* Opcodes */
-
-enum {
-    JVM_OPC_nop                 = 0,
-    JVM_OPC_aconst_null         = 1,
-    JVM_OPC_iconst_m1           = 2,
-    JVM_OPC_iconst_0            = 3,
-    JVM_OPC_iconst_1            = 4,
-    JVM_OPC_iconst_2            = 5,
-    JVM_OPC_iconst_3            = 6,
-    JVM_OPC_iconst_4            = 7,
-    JVM_OPC_iconst_5            = 8,
-    JVM_OPC_lconst_0            = 9,
-    JVM_OPC_lconst_1            = 10,
-    JVM_OPC_fconst_0            = 11,
-    JVM_OPC_fconst_1            = 12,
-    JVM_OPC_fconst_2            = 13,
-    JVM_OPC_dconst_0            = 14,
-    JVM_OPC_dconst_1            = 15,
-    JVM_OPC_bipush              = 16,
-    JVM_OPC_sipush              = 17,
-    JVM_OPC_ldc                 = 18,
-    JVM_OPC_ldc_w               = 19,
-    JVM_OPC_ldc2_w              = 20,
-    JVM_OPC_iload               = 21,
-    JVM_OPC_lload               = 22,
-    JVM_OPC_fload               = 23,
-    JVM_OPC_dload               = 24,
-    JVM_OPC_aload               = 25,
-    JVM_OPC_iload_0             = 26,
-    JVM_OPC_iload_1             = 27,
-    JVM_OPC_iload_2             = 28,
-    JVM_OPC_iload_3             = 29,
-    JVM_OPC_lload_0             = 30,
-    JVM_OPC_lload_1             = 31,
-    JVM_OPC_lload_2             = 32,
-    JVM_OPC_lload_3             = 33,
-    JVM_OPC_fload_0             = 34,
-    JVM_OPC_fload_1             = 35,
-    JVM_OPC_fload_2             = 36,
-    JVM_OPC_fload_3             = 37,
-    JVM_OPC_dload_0             = 38,
-    JVM_OPC_dload_1             = 39,
-    JVM_OPC_dload_2             = 40,
-    JVM_OPC_dload_3             = 41,
-    JVM_OPC_aload_0             = 42,
-    JVM_OPC_aload_1             = 43,
-    JVM_OPC_aload_2             = 44,
-    JVM_OPC_aload_3             = 45,
-    JVM_OPC_iaload              = 46,
-    JVM_OPC_laload              = 47,
-    JVM_OPC_faload              = 48,
-    JVM_OPC_daload              = 49,
-    JVM_OPC_aaload              = 50,
-    JVM_OPC_baload              = 51,
-    JVM_OPC_caload              = 52,
-    JVM_OPC_saload              = 53,
-    JVM_OPC_istore              = 54,
-    JVM_OPC_lstore              = 55,
-    JVM_OPC_fstore              = 56,
-    JVM_OPC_dstore              = 57,
-    JVM_OPC_astore              = 58,
-    JVM_OPC_istore_0            = 59,
-    JVM_OPC_istore_1            = 60,
-    JVM_OPC_istore_2            = 61,
-    JVM_OPC_istore_3            = 62,
-    JVM_OPC_lstore_0            = 63,
-    JVM_OPC_lstore_1            = 64,
-    JVM_OPC_lstore_2            = 65,
-    JVM_OPC_lstore_3            = 66,
-    JVM_OPC_fstore_0            = 67,
-    JVM_OPC_fstore_1            = 68,
-    JVM_OPC_fstore_2            = 69,
-    JVM_OPC_fstore_3            = 70,
-    JVM_OPC_dstore_0            = 71,
-    JVM_OPC_dstore_1            = 72,
-    JVM_OPC_dstore_2            = 73,
-    JVM_OPC_dstore_3            = 74,
-    JVM_OPC_astore_0            = 75,
-    JVM_OPC_astore_1            = 76,
-    JVM_OPC_astore_2            = 77,
-    JVM_OPC_astore_3            = 78,
-    JVM_OPC_iastore             = 79,
-    JVM_OPC_lastore             = 80,
-    JVM_OPC_fastore             = 81,
-    JVM_OPC_dastore             = 82,
-    JVM_OPC_aastore             = 83,
-    JVM_OPC_bastore             = 84,
-    JVM_OPC_castore             = 85,
-    JVM_OPC_sastore             = 86,
-    JVM_OPC_pop                 = 87,
-    JVM_OPC_pop2                = 88,
-    JVM_OPC_dup                 = 89,
-    JVM_OPC_dup_x1              = 90,
-    JVM_OPC_dup_x2              = 91,
-    JVM_OPC_dup2                = 92,
-    JVM_OPC_dup2_x1             = 93,
-    JVM_OPC_dup2_x2             = 94,
-    JVM_OPC_swap                = 95,
-    JVM_OPC_iadd                = 96,
-    JVM_OPC_ladd                = 97,
-    JVM_OPC_fadd                = 98,
-    JVM_OPC_dadd                = 99,
-    JVM_OPC_isub                = 100,
-    JVM_OPC_lsub                = 101,
-    JVM_OPC_fsub                = 102,
-    JVM_OPC_dsub                = 103,
-    JVM_OPC_imul                = 104,
-    JVM_OPC_lmul                = 105,
-    JVM_OPC_fmul                = 106,
-    JVM_OPC_dmul                = 107,
-    JVM_OPC_idiv                = 108,
-    JVM_OPC_ldiv                = 109,
-    JVM_OPC_fdiv                = 110,
-    JVM_OPC_ddiv                = 111,
-    JVM_OPC_irem                = 112,
-    JVM_OPC_lrem                = 113,
-    JVM_OPC_frem                = 114,
-    JVM_OPC_drem                = 115,
-    JVM_OPC_ineg                = 116,
-    JVM_OPC_lneg                = 117,
-    JVM_OPC_fneg                = 118,