changeset 35618:22e5c89b1769

Merge
author minqi
date Fri, 15 Jan 2016 19:18:42 +0000
parents f14f253aaa4d 533fa4499540
children 3cb8200a47c6
files jdk/src/java.base/share/classes/java/lang/invoke/DontInline.java jdk/src/java.base/share/classes/java/lang/invoke/ForceInline.java jdk/src/java.base/share/classes/java/lang/invoke/Stable.java jdk/src/java.base/share/classes/jdk/Exported.java jdk/src/java.base/share/classes/jdk/internal/misc/CleanerImpl.java jdk/src/java.base/share/classes/sun/misc/MessageUtils.java jdk/src/java.base/share/classes/sun/misc/VM.java jdk/src/java.base/share/classes/sun/misc/VMNotification.java jdk/src/java.base/share/native/libjava/MessageUtils.c jdk/src/java.base/unix/classes/sun/misc/OSEnvironment.java jdk/src/java.base/windows/classes/sun/misc/OSEnvironment.java jdk/src/java.scripting/share/classes/javax/script/package.html jdk/test/java/lang/ProcessHandle/TEST.properties jdk/test/sun/misc/VM/GetNanoTimeAdjustment.java langtools/test/tools/javac/util/context/T7021650.java
diffstat 623 files changed, 4383 insertions(+), 3724 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Jan 15 08:53:23 2016 -0800
+++ b/.hgtags	Fri Jan 15 19:18:42 2016 +0000
@@ -342,3 +342,4 @@
 4edcff1b9a8875eb6380a2165dfec599e8e3f7c0 jdk-9+97
 d00ad2d9049ac60815f70bff445e95df85648bd2 jdk-9+98
 f9bcdce2df26678c3fe468130b535c0342c69b89 jdk-9+99
+4379223f8806626852c46c52d4e7a27a584b406e jdk-9+100
--- a/.hgtags-top-repo	Fri Jan 15 08:53:23 2016 -0800
+++ b/.hgtags-top-repo	Fri Jan 15 19:18:42 2016 +0000
@@ -342,3 +342,4 @@
 75c3897541ecb52ee16d001ea605b12971df7303 jdk-9+97
 48987460c7d49a29013963ee44d090194396bb61 jdk-9+98
 7c0577bea4c65d69c5bef67023a89d2efa4fb2f7 jdk-9+99
+c1f30ac14db0eaff398429c04cd9fab92e1b4b2a jdk-9+100
--- a/common/autoconf/build-performance.m4	Fri Jan 15 08:53:23 2016 -0800
+++ b/common/autoconf/build-performance.m4	Fri Jan 15 19:18:42 2016 +0000
@@ -253,6 +253,24 @@
 
 ################################################################################
 #
+# Runs icecc-create-env once and prints the error if it fails
+#
+# $1: arguments to icecc-create-env
+# $2: log file
+#
+AC_DEFUN([BPERF_RUN_ICECC_CREATE_ENV],
+[
+  cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
+      && ${ICECC_CREATE_ENV} $1 > $2 2>&1
+  if test "$?" != "0"; then
+    AC_MSG_NOTICE([icecc-create-env output:])
+    cat $2
+    AC_MSG_ERROR([Failed to create icecc compiler environment])
+  fi
+])
+
+################################################################################
+#
 # Optionally enable distributed compilation of native code using icecc/icecream
 #
 AC_DEFUN([BPERF_SETUP_ICECC],
@@ -271,16 +289,18 @@
     # be sent to the other hosts in the icecream cluster.
     icecc_create_env_log="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/icecc_create_env.log"
     ${MKDIR} -p ${CONFIGURESUPPORT_OUTPUTDIR}/icecc
-    AC_MSG_CHECKING([for icecc build environment for target compiler])
+    # Older versions of icecc does not have the --gcc parameter
+    if ${ICECC_CREATE_ENV} | $GREP -q -e --gcc; then
+      icecc_gcc_arg="--gcc"
+    fi
     if test "x${TOOLCHAIN_TYPE}" = "xgcc"; then
-      cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
-          && ${ICECC_CREATE_ENV} --gcc ${CC} ${CXX} > ${icecc_create_env_log}
+      BPERF_RUN_ICECC_CREATE_ENV([${icecc_gcc_arg} ${CC} ${CXX}], \
+          ${icecc_create_env_log})
     elif test "x$TOOLCHAIN_TYPE" = "xclang"; then
       # For clang, the icecc compilerwrapper is needed. It usually resides next
       # to icecc-create-env.
       BASIC_REQUIRE_PROGS(ICECC_WRAPPER, compilerwrapper)
-      cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
-          && ${ICECC_CREATE_ENV} --clang ${CC} ${ICECC_WRAPPER} > ${icecc_create_env_log}
+      BPERF_RUN_ICECC_CREATE_ENV([--clang ${CC} ${ICECC_WRAPPER}], ${icecc_create_env_log})
     else
       AC_MSG_ERROR([Can only create icecc compiler packages for toolchain types gcc and clang])
     fi
@@ -289,24 +309,31 @@
     # to find it.
     ICECC_ENV_BUNDLE_BASENAME="`${SED} -n '/^creating/s/creating //p' ${icecc_create_env_log}`"
     ICECC_ENV_BUNDLE="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/${ICECC_ENV_BUNDLE_BASENAME}"
+    if test ! -f ${ICECC_ENV_BUNDLE}; then
+      AC_MSG_ERROR([icecc-create-env did not produce an environment ${ICECC_ENV_BUNDLE}])
+    fi
+    AC_MSG_CHECKING([for icecc build environment for target compiler])
     AC_MSG_RESULT([${ICECC_ENV_BUNDLE}])
     ICECC="ICECC_VERSION=${ICECC_ENV_BUNDLE} ICECC_CC=${CC} ICECC_CXX=${CXX} ${ICECC_CMD}"
 
     if test "x${COMPILE_TYPE}" = "xcross"; then
       # If cross compiling, create a separate env package for the build compiler
-      AC_MSG_CHECKING([for icecc build environment for build compiler])
       # Assume "gcc" or "cc" is gcc and "clang" is clang. Otherwise bail.
+      icecc_create_env_log_build="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/icecc_create_env_build.log"
       if test "x${BUILD_CC##*/}" = "xgcc" ||  test "x${BUILD_CC##*/}" = "xcc"; then
-        cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
-            && ${ICECC_CREATE_ENV} --gcc ${BUILD_CC} ${BUILD_CXX} > ${icecc_create_env_log}
+        BPERF_RUN_ICECC_CREATE_ENV([${icecc_gcc_arg} ${BUILD_CC} ${BUILD_CXX}], \
+            ${icecc_create_env_log_build})
       elif test "x${BUILD_CC##*/}" = "xclang"; then
-        cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
-            && ${ICECC_CREATE_ENV} --clang ${BUILD_CC} ${ICECC_WRAPPER} > ${icecc_create_env_log}
+        BPERF_RUN_ICECC_CREATE_ENV([--clang ${BUILD_CC} ${ICECC_WRAPPER}], ${icecc_create_env_log_build})
       else
         AC_MSG_ERROR([Cannot create icecc compiler package for ${BUILD_CC}])
       fi
-      ICECC_ENV_BUNDLE_BASENAME="`${SED} -n '/^creating/s/creating //p' ${icecc_create_env_log}`"
+      ICECC_ENV_BUNDLE_BASENAME="`${SED} -n '/^creating/s/creating //p' ${icecc_create_env_log_build}`"
       ICECC_ENV_BUNDLE="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/${ICECC_ENV_BUNDLE_BASENAME}"
+      if test ! -f ${ICECC_ENV_BUNDLE}; then
+        AC_MSG_ERROR([icecc-create-env did not produce an environment ${ICECC_ENV_BUNDLE}])
+      fi
+      AC_MSG_CHECKING([for icecc build environment for build compiler])
       AC_MSG_RESULT([${ICECC_ENV_BUNDLE}])
       BUILD_ICECC="ICECC_VERSION=${ICECC_ENV_BUNDLE} ICECC_CC=${BUILD_CC} \
           ICECC_CXX=${BUILD_CXX} ${ICECC_CMD}"
--- a/common/autoconf/flags.m4	Fri Jan 15 08:53:23 2016 -0800
+++ b/common/autoconf/flags.m4	Fri Jan 15 19:18:42 2016 +0000
@@ -128,6 +128,26 @@
   else
     COMPILER_TARGET_BITS_FLAG="-m"
     COMPILER_COMMAND_FILE_FLAG="@"
+
+    # The solstudio linker does not support @-files.
+    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
+      COMPILER_COMMAND_FILE_FLAG=
+    fi
+
+    # Check if @file is supported by gcc
+    if test "x$TOOLCHAIN_TYPE" = xgcc; then
+      AC_MSG_CHECKING([if @file is supported by gcc])
+      # Extra emtpy "" to prevent ECHO from interpreting '--version' as argument
+      $ECHO "" "--version" > command.file
+      if $CXX @command.file 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
+        AC_MSG_RESULT(yes)
+        COMPILER_COMMAND_FILE_FLAG="@"
+      else
+        AC_MSG_RESULT(no)
+        COMPILER_COMMAND_FILE_FLAG=
+      fi
+      rm -rf command.file
+    fi
   fi
   AC_SUBST(COMPILER_TARGET_BITS_FLAG)
   AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
--- a/common/autoconf/generated-configure.sh	Fri Jan 15 08:53:23 2016 -0800
+++ b/common/autoconf/generated-configure.sh	Fri Jan 15 19:18:42 2016 +0000
@@ -3794,6 +3794,15 @@
 
 ################################################################################
 #
+# Runs icecc-create-env once and prints the error if it fails
+#
+# $1: arguments to icecc-create-env
+# $2: log file
+#
+
+
+################################################################################
+#
 # Optionally enable distributed compilation of native code using icecc/icecream
 #
 
@@ -4308,7 +4317,7 @@
 
 
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -4801,7 +4810,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1450277321
+DATE_WHEN_GENERATED=1452261921
 
 ###############################################################################
 #
@@ -45930,6 +45939,29 @@
   else
     COMPILER_TARGET_BITS_FLAG="-m"
     COMPILER_COMMAND_FILE_FLAG="@"
+
+    # The solstudio linker does not support @-files.
+    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
+      COMPILER_COMMAND_FILE_FLAG=
+    fi
+
+    # Check if @file is supported by gcc
+    if test "x$TOOLCHAIN_TYPE" = xgcc; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking if @file is supported by gcc" >&5
+$as_echo_n "checking if @file is supported by gcc... " >&6; }
+      # Extra emtpy "" to prevent ECHO from interpreting '--version' as argument
+      $ECHO "" "--version" > command.file
+      if $CXX @command.file 2>&5 >&5; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+        COMPILER_COMMAND_FILE_FLAG="@"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+        COMPILER_COMMAND_FILE_FLAG=
+      fi
+      rm -rf command.file
+    fi
   fi
 
 
@@ -51742,12 +51774,28 @@
     fi
 
     if test "x${with_cups}" != x; then
-      CUPS_CFLAGS="-I${with_cups}/include"
-      CUPS_FOUND=yes
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cups headers" >&5
+$as_echo_n "checking for cups headers... " >&6; }
+      if test -s "${with_cups}/include/cups/cups.h"; then
+        CUPS_CFLAGS="-I${with_cups}/include"
+        CUPS_FOUND=yes
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUPS_FOUND" >&5
+$as_echo "$CUPS_FOUND" >&6; }
+      else
+        as_fn_error $? "Can't find 'include/cups/cups.h' under ${with_cups} given with the --with-cups option." "$LINENO" 5
+      fi
     fi
     if test "x${with_cups_include}" != x; then
-      CUPS_CFLAGS="-I${with_cups_include}"
-      CUPS_FOUND=yes
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cups headers" >&5
+$as_echo_n "checking for cups headers... " >&6; }
+      if test -s "${with_cups_include}/cups/cups.h"; then
+        CUPS_CFLAGS="-I${with_cups_include}"
+        CUPS_FOUND=yes
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUPS_FOUND" >&5
+$as_echo "$CUPS_FOUND" >&6; }
+      else
+        as_fn_error $? "Can't find 'cups/cups.h' under ${with_cups_include} given with the --with-cups-include option." "$LINENO" 5
+      fi
     fi
     if test "x$CUPS_FOUND" = xno; then
       # Are the cups headers installed in the default /usr/include location?
@@ -59543,11 +59591,23 @@
     # be sent to the other hosts in the icecream cluster.
     icecc_create_env_log="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/icecc_create_env.log"
     ${MKDIR} -p ${CONFIGURESUPPORT_OUTPUTDIR}/icecc
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for icecc build environment for target compiler" >&5
-$as_echo_n "checking for icecc build environment for target compiler... " >&6; }
+    # Older versions of icecc does not have the --gcc parameter
+    if ${ICECC_CREATE_ENV} | $GREP -q -e --gcc; then
+      icecc_gcc_arg="--gcc"
+    fi
     if test "x${TOOLCHAIN_TYPE}" = "xgcc"; then
-      cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
-          && ${ICECC_CREATE_ENV} --gcc ${CC} ${CXX} > ${icecc_create_env_log}
+
+  cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
+      && ${ICECC_CREATE_ENV} ${icecc_gcc_arg} ${CC} ${CXX} > \
+          ${icecc_create_env_log} 2>&1
+  if test "$?" != "0"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: icecc-create-env output:" >&5
+$as_echo "$as_me: icecc-create-env output:" >&6;}
+    cat \
+          ${icecc_create_env_log}
+    as_fn_error $? "Failed to create icecc compiler environment" "$LINENO" 5
+  fi
+
     elif test "x$TOOLCHAIN_TYPE" = "xclang"; then
       # For clang, the icecc compilerwrapper is needed. It usually resides next
       # to icecc-create-env.
@@ -59755,8 +59815,16 @@
   fi
 
 
-      cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
-          && ${ICECC_CREATE_ENV} --clang ${CC} ${ICECC_WRAPPER} > ${icecc_create_env_log}
+
+  cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
+      && ${ICECC_CREATE_ENV} --clang ${CC} ${ICECC_WRAPPER} > ${icecc_create_env_log} 2>&1
+  if test "$?" != "0"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: icecc-create-env output:" >&5
+$as_echo "$as_me: icecc-create-env output:" >&6;}
+    cat ${icecc_create_env_log}
+    as_fn_error $? "Failed to create icecc compiler environment" "$LINENO" 5
+  fi
+
     else
       as_fn_error $? "Can only create icecc compiler packages for toolchain types gcc and clang" "$LINENO" 5
     fi
@@ -59765,26 +59833,53 @@
     # to find it.
     ICECC_ENV_BUNDLE_BASENAME="`${SED} -n '/^creating/s/creating //p' ${icecc_create_env_log}`"
     ICECC_ENV_BUNDLE="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/${ICECC_ENV_BUNDLE_BASENAME}"
+    if test ! -f ${ICECC_ENV_BUNDLE}; then
+      as_fn_error $? "icecc-create-env did not produce an environment ${ICECC_ENV_BUNDLE}" "$LINENO" 5
+    fi
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for icecc build environment for target compiler" >&5
+$as_echo_n "checking for icecc build environment for target compiler... " >&6; }
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ICECC_ENV_BUNDLE}" >&5
 $as_echo "${ICECC_ENV_BUNDLE}" >&6; }
     ICECC="ICECC_VERSION=${ICECC_ENV_BUNDLE} ICECC_CC=${CC} ICECC_CXX=${CXX} ${ICECC_CMD}"
 
     if test "x${COMPILE_TYPE}" = "xcross"; then
       # If cross compiling, create a separate env package for the build compiler
+      # Assume "gcc" or "cc" is gcc and "clang" is clang. Otherwise bail.
+      icecc_create_env_log_build="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/icecc_create_env_build.log"
+      if test "x${BUILD_CC##*/}" = "xgcc" ||  test "x${BUILD_CC##*/}" = "xcc"; then
+
+  cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
+      && ${ICECC_CREATE_ENV} ${icecc_gcc_arg} ${BUILD_CC} ${BUILD_CXX} > \
+            ${icecc_create_env_log_build} 2>&1
+  if test "$?" != "0"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: icecc-create-env output:" >&5
+$as_echo "$as_me: icecc-create-env output:" >&6;}
+    cat \
+            ${icecc_create_env_log_build}
+    as_fn_error $? "Failed to create icecc compiler environment" "$LINENO" 5
+  fi
+
+      elif test "x${BUILD_CC##*/}" = "xclang"; then
+
+  cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
+      && ${ICECC_CREATE_ENV} --clang ${BUILD_CC} ${ICECC_WRAPPER} > ${icecc_create_env_log_build} 2>&1
+  if test "$?" != "0"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: icecc-create-env output:" >&5
+$as_echo "$as_me: icecc-create-env output:" >&6;}
+    cat ${icecc_create_env_log_build}
+    as_fn_error $? "Failed to create icecc compiler environment" "$LINENO" 5
+  fi
+
+      else
+        as_fn_error $? "Cannot create icecc compiler package for ${BUILD_CC}" "$LINENO" 5
+      fi
+      ICECC_ENV_BUNDLE_BASENAME="`${SED} -n '/^creating/s/creating //p' ${icecc_create_env_log_build}`"
+      ICECC_ENV_BUNDLE="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/${ICECC_ENV_BUNDLE_BASENAME}"
+      if test ! -f ${ICECC_ENV_BUNDLE}; then
+        as_fn_error $? "icecc-create-env did not produce an environment ${ICECC_ENV_BUNDLE}" "$LINENO" 5
+      fi
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for icecc build environment for build compiler" >&5
 $as_echo_n "checking for icecc build environment for build compiler... " >&6; }
-      # Assume "gcc" or "cc" is gcc and "clang" is clang. Otherwise bail.
-      if test "x${BUILD_CC##*/}" = "xgcc" ||  test "x${BUILD_CC##*/}" = "xcc"; then
-        cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
-            && ${ICECC_CREATE_ENV} --gcc ${BUILD_CC} ${BUILD_CXX} > ${icecc_create_env_log}
-      elif test "x${BUILD_CC##*/}" = "xclang"; then
-        cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
-            && ${ICECC_CREATE_ENV} --clang ${BUILD_CC} ${ICECC_WRAPPER} > ${icecc_create_env_log}
-      else
-        as_fn_error $? "Cannot create icecc compiler package for ${BUILD_CC}" "$LINENO" 5
-      fi
-      ICECC_ENV_BUNDLE_BASENAME="`${SED} -n '/^creating/s/creating //p' ${icecc_create_env_log}`"
-      ICECC_ENV_BUNDLE="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/${ICECC_ENV_BUNDLE_BASENAME}"
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ICECC_ENV_BUNDLE}" >&5
 $as_echo "${ICECC_ENV_BUNDLE}" >&6; }
       BUILD_ICECC="ICECC_VERSION=${ICECC_ENV_BUNDLE} ICECC_CC=${BUILD_CC} \
--- a/common/autoconf/lib-cups.m4	Fri Jan 15 08:53:23 2016 -0800
+++ b/common/autoconf/lib-cups.m4	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -48,12 +48,24 @@
     fi
 
     if test "x${with_cups}" != x; then
-      CUPS_CFLAGS="-I${with_cups}/include"
-      CUPS_FOUND=yes
+      AC_MSG_CHECKING([for cups headers])
+      if test -s "${with_cups}/include/cups/cups.h"; then
+        CUPS_CFLAGS="-I${with_cups}/include"
+        CUPS_FOUND=yes
+        AC_MSG_RESULT([$CUPS_FOUND])
+      else
+        AC_MSG_ERROR([Can't find 'include/cups/cups.h' under ${with_cups} given with the --with-cups option.])
+      fi
     fi
     if test "x${with_cups_include}" != x; then
-      CUPS_CFLAGS="-I${with_cups_include}"
-      CUPS_FOUND=yes
+      AC_MSG_CHECKING([for cups headers])
+      if test -s "${with_cups_include}/cups/cups.h"; then
+        CUPS_CFLAGS="-I${with_cups_include}"
+        CUPS_FOUND=yes
+        AC_MSG_RESULT([$CUPS_FOUND])
+      else
+        AC_MSG_ERROR([Can't find 'cups/cups.h' under ${with_cups_include} given with the --with-cups-include option.])
+      fi
     fi
     if test "x$CUPS_FOUND" = xno; then
       # Are the cups headers installed in the default /usr/include location?
--- a/corba/.hgtags	Fri Jan 15 08:53:23 2016 -0800
+++ b/corba/.hgtags	Fri Jan 15 19:18:42 2016 +0000
@@ -342,3 +342,4 @@
 10a482b863582376d4ca229090334b23b05159fc jdk-9+97
 ea285530245cf4e0edf0479121a41347d3030eba jdk-9+98
 180212ee1d8710691ba9944593dfc1ff3e4f1532 jdk-9+99
+791d0d3ac0138faeb6110bd840a4545bc1950df2 jdk-9+100
--- a/hotspot/.hgtags	Fri Jan 15 08:53:23 2016 -0800
+++ b/hotspot/.hgtags	Fri Jan 15 19:18:42 2016 +0000
@@ -502,3 +502,4 @@
 de592ea5f7ba0f8a8c5afc03bd169f7690c72b6f jdk-9+97
 e5b1a23be1e105417ba1c4c576ab373eb3fa2c2b jdk-9+98
 f008e8cc10d5b3212fb22d58c96fa01d38654f19 jdk-9+99
+bdb0acafc63c42e84d9d8195bf2e2b25ee9c3306 jdk-9+100
--- a/hotspot/src/share/vm/prims/jvm.cpp	Fri Jan 15 08:53:23 2016 -0800
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Fri Jan 15 19:18:42 2016 +0000
@@ -285,7 +285,7 @@
   return os::javaTimeNanos();
 JVM_END
 
-// The function below is actually exposed by sun.misc.VM and not
+// The function below is actually exposed by jdk.internal.misc.VM and not
 // java.lang.System, but we choose to keep it here so that it stays next
 // to JVM_CurrentTimeMillis and JVM_NanoTime
 
--- a/jaxp/.hgtags	Fri Jan 15 08:53:23 2016 -0800
+++ b/jaxp/.hgtags	Fri Jan 15 19:18:42 2016 +0000
@@ -342,3 +342,4 @@
 9c107c050335d7ee63b2a8b38ca5d498f19713a2 jdk-9+97
 52b01339235f24c93b679bd6b8fb36a1072ad0ac jdk-9+98
 52774b544850c791f1d1c67db2601b33739b18c9 jdk-9+99
+d45bcd374f6057851e3c2dcd45607cd362afadfa jdk-9+100
--- a/jaxws/.hgtags	Fri Jan 15 08:53:23 2016 -0800
+++ b/jaxws/.hgtags	Fri Jan 15 19:18:42 2016 +0000
@@ -345,3 +345,4 @@
 7293db4716ee25b814e14f738b9acfb85700e3fa jdk-9+97
 67c84077edc3db6b24998b35970b37c01aae985e jdk-9+98
 97b31ca0dd77483cf20ff99a033a455673639578 jdk-9+99
+d0a97e57d2336238edf6a4cd60aafe67deb7258d jdk-9+100
--- a/jdk/.hgtags	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/.hgtags	Fri Jan 15 19:18:42 2016 +0000
@@ -342,3 +342,4 @@
 fdd84b2265ddce7f50e084b7c8635189bba6f012 jdk-9+97
 f86ee68d1107dad41a27efc34306e0e56244a12e jdk-9+98
 e1a789be1535741274c9779f4d4ca3495196b5c3 jdk-9+99
+3d452840f48299a36842760d17c0c8402f0e1266 jdk-9+100
--- a/jdk/make/gendata/GendataBreakIterator.gmk	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/make/gendata/GendataBreakIterator.gmk	Fri Jan 15 19:18:42 2016 +0000
@@ -48,7 +48,6 @@
 $(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR, \
     SETUP := GENERATE_OLDBYTECODE, \
     SRC := $(TEXT_SRCDIR), \
-    INCLUDES := $(TEXT_PKG), \
     INCLUDE_FILES := $(TEXT_SOURCES), \
     BIN := $(BREAK_ITERATOR_CLASSES)))
 
--- a/jdk/make/mapfiles/libjava/mapfile-vers	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/make/mapfiles/libjava/mapfile-vers	Fri Jan 15 19:18:42 2016 +0000
@@ -216,6 +216,7 @@
 		Java_java_lang_SecurityManager_getClassContext;
 		Java_java_lang_Shutdown_halt0;
 		Java_java_lang_String_intern;
+		Java_java_lang_StringCoding_err;
 		Java_java_lang_StringUTF16_isBigEndian;
 		Java_java_lang_System_identityHashCode;
 		Java_java_lang_System_initProperties;
@@ -243,8 +244,6 @@
 		Java_java_util_TimeZone_getSystemTimeZoneID;
 		Java_java_util_TimeZone_getSystemGMTOffsetID;
 		Java_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8;
-		Java_sun_misc_MessageUtils_toStderr;
-		Java_sun_misc_MessageUtils_toStdout;
 		Java_sun_misc_NativeSignalHandler_handle0;
 		Java_sun_misc_Signal_findSignal;
 		Java_sun_misc_Signal_handle0;
@@ -274,12 +273,12 @@
 		Java_sun_reflect_Reflection_getClassAccessFlags;
                 Java_sun_misc_Version_getJdkVersionInfo;
                 Java_sun_misc_Version_getJvmVersionInfo;
-		Java_sun_misc_VM_latestUserDefinedLoader;
-                Java_sun_misc_VM_getuid;
-                Java_sun_misc_VM_geteuid;
-                Java_sun_misc_VM_getgid;
-                Java_sun_misc_VM_getegid;
-                Java_sun_misc_VM_initialize;
+		Java_jdk_internal_misc_VM_latestUserDefinedLoader;
+                Java_jdk_internal_misc_VM_getuid;
+                Java_jdk_internal_misc_VM_geteuid;
+                Java_jdk_internal_misc_VM_getgid;
+                Java_jdk_internal_misc_VM_getegid;
+                Java_jdk_internal_misc_VM_initialize;
 		Java_sun_misc_VMSupport_initAgentProperties;
 		Java_sun_misc_VMSupport_getVMTemporaryDirectory;
 
--- a/jdk/make/src/classes/build/tools/dtdbuilder/DTDParser.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/make/src/classes/build/tools/dtdbuilder/DTDParser.java	Fri Jan 15 19:18:42 2016 +0000
@@ -35,8 +35,6 @@
 import java.util.BitSet;
 import java.text.MessageFormat;
 
-import sun.misc.MessageUtils;
-
 /**
  * A parser for DTDs. This parser roughly corresponds to the
  * rules specified in "The SGML Handbook" by Charles F. Goldfarb.
--- a/jdk/make/src/classes/build/tools/spp/Spp.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/make/src/classes/build/tools/spp/Spp.java	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -32,9 +32,10 @@
  * Spp: A simple regex-based stream preprocessor based on Mark Reinhold's
  *      sed-based spp.sh
  *
- * Usage: java build.tools.spp.Spp [-be] [-Kkey] -Dvar=value ... <in >out
+ * Usage: java build.tools.spp.Spp [-be] [-nel] [-Kkey] -Dvar=value ... <in >out
  *
- * Source-file constructs
+ * If -nel is declared then empty lines will not be substituted for lines of
+ * text in the template that do not appear in the output.
  *
  *   Meaningful only at beginning of line, works with any number of keys:
  *
@@ -64,9 +65,10 @@
 
 public class Spp {
     public static void main(String args[]) throws Exception {
-        Map<String, String> vars = new HashMap<String, String>();
-        Set<String> keys = new HashSet<String>();
+        Map<String, String> vars = new HashMap<>();
+        Set<String> keys = new HashSet<>();
         boolean be = false;
+        boolean el = true;
 
         for (String arg:args) {
             if (arg.startsWith("-D")) {
@@ -76,8 +78,10 @@
                 keys.add(arg.substring(2));
             } else if ("-be".equals(arg)) {
                 be = true;
+            } else if ("-nel".equals(arg)) {
+                el = false;
             } else {
-                System.err.println("Usage: java build.tools.spp.Spp [-be] [-Kkey] -Dvar=value ... <in >out");
+                System.err.println("Usage: java build.tools.spp.Spp [-be] [-nel] [-Kkey] -Dvar=value ... <in >out");
                 System.exit(-1);
             }
         }
@@ -85,7 +89,7 @@
         StringBuffer out = new StringBuffer();
         new Spp().spp(new Scanner(System.in),
                       out, "",
-                      keys, vars, be,
+                      keys, vars, be, el,
                       false);
         System.out.print(out.toString());
     }
@@ -93,7 +97,7 @@
     static final String LNSEP = System.getProperty("line.separator");
     static final String KEY = "([a-zA-Z0-9]+)";
     static final String VAR = "([a-zA-Z0-9_\\-]+)";
-    static final String TEXT = "([a-zA-Z0-9&;,.<>/#() \\$]+)"; // $ -- hack embedded $var$
+    static final String TEXT = "([a-zA-Z0-9&;,.<>/#() \\?\\[\\]\\$]+)"; // $ -- hack embedded $var$
 
     static final int GN_NOT = 1;
     static final int GN_KEY = 2;
@@ -101,11 +105,11 @@
     static final int GN_NO  = 5;
     static final int GN_VAR = 6;
 
-    Matcher ifkey = Pattern.compile("^#if\\[(!)?" + KEY + "\\]").matcher("");
-    Matcher elsekey = Pattern.compile("^#else\\[(!)?" + KEY + "\\]").matcher("");
-    Matcher endkey = Pattern.compile("^#end\\[(!)?" + KEY + "\\]").matcher("");
-    Matcher  vardef = Pattern.compile("\\{#if\\[(!)?" + KEY + "\\]\\?" + TEXT + "(:"+ TEXT + ")?\\}|\\$" + VAR + "\\$").matcher("");
-    Matcher  vardef2 = Pattern.compile("\\$" + VAR + "\\$").matcher("");
+    final Matcher   ifkey = Pattern.compile("^#if\\[(!)?" + KEY + "\\]").matcher("");
+    final Matcher elsekey = Pattern.compile("^#else\\[(!)?" + KEY + "\\]").matcher("");
+    final Matcher  endkey = Pattern.compile("^#end\\[(!)?" + KEY + "\\]").matcher("");
+    final Matcher  vardef = Pattern.compile("\\{#if\\[(!)?" + KEY + "\\]\\?" + TEXT + "(:"+ TEXT + ")?\\}|\\$" + VAR + "\\$").matcher("");
+    final Matcher vardef2 = Pattern.compile("\\$" + VAR + "\\$").matcher("");
 
     void append(StringBuffer buf, String ln,
                 Set<String> keys, Map<String, String> vars) {
@@ -135,7 +139,7 @@
     // return true if #end[key], #end or EOF reached
     boolean spp(Scanner in, StringBuffer buf, String key,
                 Set<String> keys, Map<String, String> vars,
-                boolean be, boolean skip) {
+                boolean be, boolean el, boolean skip) {
         while (in.hasNextLine()) {
             String ln = in.nextLine();
             if (be) {
@@ -154,9 +158,9 @@
                 boolean test = keys.contains(k);
                 if (ifkey.group(GN_NOT) != null)
                     test = !test;
-                buf.append(LNSEP);
-                if (!spp(in, buf, k, keys, vars, be, skip || !test)) {
-                    spp(in, buf, k, keys, vars, be, skip || test);
+                if (el) buf.append(LNSEP);
+                if (!spp(in, buf, k, keys, vars, be, el, skip || !test)) {
+                    spp(in, buf, k, keys, vars, be, el, skip || test);
                 }
                 continue;
             }
@@ -164,14 +168,14 @@
                 if (!key.equals(elsekey.group(GN_KEY))) {
                     throw new Error("Mis-matched #if-else-end at line <" + ln + ">");
                 }
-                buf.append(LNSEP);
+                if (el) buf.append(LNSEP);
                 return false;
             }
             if (endkey.reset(ln).find()) {
                 if (!key.equals(endkey.group(GN_KEY))) {
                     throw new Error("Mis-matched #if-else-end at line <" + ln + ">");
                 }
-                buf.append(LNSEP);
+                if (el) buf.append(LNSEP);
                 return true;
             }
             if (ln.startsWith("#warn")) {
@@ -181,8 +185,9 @@
             }
             if (!skip) {
                 append(buf, ln, keys, vars);
+                if (!el) buf.append(LNSEP);
             }
-            buf.append(LNSEP);
+            if (el) buf.append(LNSEP);
         }
         return true;
     }
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java	Fri Jan 15 19:18:42 2016 +0000
@@ -26,7 +26,9 @@
 package com.sun.crypto.provider;
 
 import java.security.InvalidKeyException;
+import java.util.Objects;
 
+import jdk.internal.HotSpotIntrinsicCandidate;
 
 /**
  * This class represents ciphers in counter (CTR) mode.
@@ -138,7 +140,7 @@
      * <code>cipherOffset</code>.
      *
      * @param in the buffer with the input data to be encrypted
-     * @param inOffset the offset in <code>plain</code>
+     * @param inOff the offset in <code>plain</code>
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOff the offset in <code>cipher</code>
@@ -170,6 +172,15 @@
      * are encrypted on demand.
      */
     private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
+
+        cryptBlockCheck(in, inOff, len);
+        cryptBlockCheck(out, outOff, len);
+        return implCrypt(in, inOff, len, out, outOff);
+    }
+
+    // Implementation of crpyt() method. Possibly replaced with a compiler intrinsic.
+    @HotSpotIntrinsicCandidate
+    private int implCrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
         int result = len;
         while (len-- > 0) {
             if (used >= blockSize) {
@@ -181,4 +192,23 @@
         }
         return result;
     }
+
+    // Used to perform all checks required by the Java semantics
+    // (i.e., null checks and bounds checks) on the input parameters to crypt().
+    // Normally, the Java Runtime performs these checks, however, as crypt() is
+    // possibly replaced with compiler intrinsic, the JDK performs the
+    // required checks instead.
+    // Does not check accesses to class-internal (private) arrays.
+    private static void cryptBlockCheck(byte[] array, int offset, int len) {
+        Objects.requireNonNull(array);
+
+        if (offset < 0 || len < 0 || offset >= array.length) {
+            throw new ArrayIndexOutOfBoundsException(offset);
+        }
+
+        int largestIndex = offset + len - 1;
+        if (largestIndex < 0 || largestIndex >= array.length) {
+            throw new ArrayIndexOutOfBoundsException(largestIndex);
+        }
+    }
 }
--- a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java	Fri Jan 15 19:18:42 2016 +0000
@@ -2135,7 +2135,7 @@
      * corresponding modifications to the above class.
      */
     private static ClassLoader latestUserDefinedLoader() {
-        return sun.misc.VM.latestUserDefinedLoader();
+        return jdk.internal.misc.VM.latestUserDefinedLoader();
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/Class.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java	Fri Jan 15 19:18:42 2016 +0000
@@ -56,6 +56,7 @@
 import java.util.Objects;
 import java.util.StringJoiner;
 import jdk.internal.misc.Unsafe;
+import jdk.internal.misc.VM;
 import jdk.internal.HotSpotIntrinsicCandidate;
 import sun.reflect.CallerSensitive;
 import sun.reflect.ConstantPool;
@@ -360,9 +361,9 @@
             // Reflective call to get caller class is only needed if a security manager
             // is present.  Avoid the overhead of making this call otherwise.
             caller = Reflection.getCallerClass();
-            if (sun.misc.VM.isSystemDomainLoader(loader)) {
+            if (VM.isSystemDomainLoader(loader)) {
                 ClassLoader ccl = ClassLoader.getClassLoader(caller);
-                if (!sun.misc.VM.isSystemDomainLoader(ccl)) {
+                if (!VM.isSystemDomainLoader(ccl)) {
                     sm.checkPermission(
                         SecurityConstants.GET_CLASSLOADER_PERMISSION);
                 }
--- a/jdk/src/java.base/share/classes/java/lang/Integer.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Integer.java	Fri Jan 15 19:18:42 2016 +0000
@@ -28,6 +28,7 @@
 import java.lang.annotation.Native;
 import java.util.Objects;
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.VM;
 
 import static java.lang.String.COMPACT_STRINGS;
 import static java.lang.String.LATIN1;
@@ -1018,7 +1019,7 @@
      * may be controlled by the {@code -XX:AutoBoxCacheMax=<size>} option.
      * During VM initialization, java.lang.Integer.IntegerCache.high property
      * may be set and saved in the private system properties in the
-     * sun.misc.VM class.
+     * jdk.internal.misc.VM class.
      */
 
     private static class IntegerCache {
@@ -1030,7 +1031,7 @@
             // high value may be configured by property
             int h = 127;
             String integerCacheHighPropValue =
-                sun.misc.VM.getSavedProperty("java.lang.Integer.IntegerCache.high");
+                VM.getSavedProperty("java.lang.Integer.IntegerCache.high");
             if (integerCacheHighPropValue != null) {
                 try {
                     int i = parseInt(integerCacheHighPropValue);
--- a/jdk/src/java.base/share/classes/java/lang/LiveStackFrame.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/LiveStackFrame.java	Fri Jan 15 19:18:42 2016 +0000
@@ -61,6 +61,9 @@
      * local variable array is an {@link PrimitiveValue} object;
      * otherwise, the element is an {@code Object}.
      *
+     * <p>The returned array may contain null entries if a local variable is not
+     * live.
+     *
      * @return  the local variable array of this stack frame.
      */
     public Object[] getLocals();
--- a/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java	Fri Jan 15 19:18:42 2016 +0000
@@ -24,7 +24,7 @@
  */
 package java.lang;
 
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 import java.io.PrintStream;
 import java.lang.StackWalker.Option;
--- a/jdk/src/java.base/share/classes/java/lang/StringCoding.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/StringCoding.java	Fri Jan 15 19:18:42 2016 +0000
@@ -39,7 +39,6 @@
 import java.nio.charset.UnsupportedCharsetException;
 import java.util.Arrays;
 import jdk.internal.HotSpotIntrinsicCandidate;
-import sun.misc.MessageUtils;
 import sun.nio.cs.HistoricallyNamedCharset;
 import sun.nio.cs.ArrayDecoder;
 import sun.nio.cs.ArrayEncoder;
@@ -106,11 +105,11 @@
 
     private static void warnUnsupportedCharset(String csn) {
         if (warnUnsupportedCharset) {
-            // Use sun.misc.MessageUtils rather than the Logging API or
-            // System.err since this method may be called during VM
-            // initialization before either is available.
-            MessageUtils.err("WARNING: Default charset " + csn +
-                             " not supported, using ISO-8859-1 instead");
+            // Use err(String) rather than the Logging API or System.err
+            // since this method may be called during VM initialization
+            // before either is available.
+            err("WARNING: Default charset " + csn +
+                " not supported, using ISO-8859-1 instead\n");
             warnUnsupportedCharset = false;
         }
     }
@@ -341,10 +340,9 @@
         try {
             return decode("ISO-8859-1", ba, off, len);
         } catch (UnsupportedEncodingException x) {
-            // If this code is hit during VM initialization, MessageUtils is
+            // If this code is hit during VM initialization, err(String) is
             // the only way we will be able to get any kind of error message.
-            MessageUtils.err("ISO-8859-1 charset not available: "
-                             + x.toString());
+            err("ISO-8859-1 charset not available: " + x.toString() + "\n");
             // If we can not find ISO-8859-1 (a required encoding) then things
             // are seriously wrong with the installation.
             System.exit(1);
@@ -653,14 +651,20 @@
         try {
             return encode("ISO-8859-1", coder, val);
         } catch (UnsupportedEncodingException x) {
-            // If this code is hit during VM initialization, MessageUtils is
+            // If this code is hit during VM initialization, err(String) is
             // the only way we will be able to get any kind of error message.
-            MessageUtils.err("ISO-8859-1 charset not available: "
-                             + x.toString());
+            err("ISO-8859-1 charset not available: " + x.toString() + "\n");
             // If we can not find ISO-8859-1 (a required encoding) then things
             // are seriously wrong with the installation.
             System.exit(1);
             return null;
         }
     }
+
+    /**
+     *  Print a message directly to stderr, bypassing all character conversion
+     *  methods.
+     *  @param msg  message to print
+     */
+    private static native void err(String msg);
 }
--- a/jdk/src/java.base/share/classes/java/lang/System.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/System.java	Fri Jan 15 19:18:42 2016 +0000
@@ -46,6 +46,7 @@
 import jdk.internal.HotSpotIntrinsicCandidate;
 import jdk.internal.misc.JavaLangAccess;;
 import jdk.internal.misc.SharedSecrets;;
+import jdk.internal.misc.VM;
 import jdk.internal.logger.LoggerFinderLoader;
 import jdk.internal.logger.LazyLoggers;
 import jdk.internal.logger.LocalizedLoggerWrapper;
@@ -1534,6 +1535,8 @@
      * @return an instance of {@link Logger} that can be used by the calling
      *         class.
      * @throws NullPointerException if {@code name} is {@code null}.
+     *
+     * @since 9
      */
     @CallerSensitive
     public static Logger getLogger(String name) {
@@ -1571,6 +1574,8 @@
      * resource bundle for message localization.
      * @throws NullPointerException if {@code name} is {@code null} or
      *         {@code bundle} is {@code null}.
+     *
+     * @since 9
      */
     @CallerSensitive
     public static Logger getLogger(String name, ResourceBundle bundle) {
@@ -1817,12 +1822,12 @@
         // removed from the system properties.
         //
         // See java.lang.Integer.IntegerCache and the
-        // sun.misc.VM.saveAndRemoveProperties method for example.
+        // VM.saveAndRemoveProperties method for example.
         //
         // Save a private copy of the system properties object that
         // can only be accessed by the internal implementation.  Remove
         // certain system properties that are not intended for public access.
-        sun.misc.VM.saveAndRemoveProperties(props);
+        VM.saveAndRemoveProperties(props);
 
 
         lineSeparator = props.getProperty("line.separator");
@@ -1846,7 +1851,7 @@
         // set for the class libraries. Currently this is no-op everywhere except
         // for Windows where the process-wide error mode is set before the java.io
         // classes are used.
-        sun.misc.VM.initializeOSEnvironment();
+        VM.initializeOSEnvironment();
 
         // The main thread is not added to its thread group in the same
         // way as other threads; we must do it ourselves here.
@@ -1857,10 +1862,10 @@
         setJavaLangAccess();
 
         // Subsystems that are invoked during initialization can invoke
-        // sun.misc.VM.isBooted() in order to avoid doing things that should
+        // VM.isBooted() in order to avoid doing things that should
         // wait until the application class loader has been set up.
         // IMPORTANT: Ensure that this remains the last initialization action!
-        sun.misc.VM.booted();
+        VM.booted();
     }
 
     private static void setJavaLangAccess() {
--- a/jdk/src/java.base/share/classes/java/lang/Thread.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Thread.java	Fri Jan 15 19:18:42 2016 +0000
@@ -1869,7 +1869,7 @@
      */
     public State getState() {
         // get current thread state
-        return sun.misc.VM.toThreadState(threadStatus);
+        return jdk.internal.misc.VM.toThreadState(threadStatus);
     }
 
     // Added in JSR-166
--- a/jdk/src/java.base/share/classes/java/lang/ThreadGroup.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ThreadGroup.java	Fri Jan 15 19:18:42 2016 +0000
@@ -27,7 +27,7 @@
 
 import java.io.PrintStream;
 import java.util.Arrays;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 /**
  * A thread group represents a set of threads. In addition, a thread
--- a/jdk/src/java.base/share/classes/java/lang/Throwable.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Throwable.java	Fri Jan 15 19:18:42 2016 +0000
@@ -24,7 +24,7 @@
  */
 
 package java.lang;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 import  java.io.*;
 import  java.util.*;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Fri Jan 15 19:18:42 2016 +0000
@@ -25,25 +25,25 @@
 
 package java.lang.invoke;
 
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
-import static java.lang.invoke.LambdaForm.*;
-import static java.lang.invoke.LambdaForm.BasicType.*;
-import static java.lang.invoke.MethodHandleStatics.*;
+import jdk.internal.vm.annotation.Stable;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.FieldVisitor;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import sun.invoke.util.ValueConversions;
+import sun.invoke.util.Wrapper;
 
 import java.lang.invoke.LambdaForm.NamedFunction;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.reflect.Field;
 import java.util.Arrays;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 import java.util.function.Function;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentHashMap;
 
-import jdk.internal.org.objectweb.asm.FieldVisitor;
-import sun.invoke.util.ValueConversions;
-import sun.invoke.util.Wrapper;
-
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.MethodVisitor;
+import static java.lang.invoke.LambdaForm.BasicType;
+import static java.lang.invoke.LambdaForm.BasicType.*;
+import static java.lang.invoke.MethodHandleStatics.*;
+import static jdk.internal.org.objectweb.asm.Opcodes.*;
 
 /**
  * The flavor of method handle which emulates an invoke instruction
@@ -459,7 +459,7 @@
         static final String BMH_SIG  = "L"+BMH+";";
         static final String SPECIES_DATA     = "java/lang/invoke/BoundMethodHandle$SpeciesData";
         static final String SPECIES_DATA_SIG = "L"+SPECIES_DATA+";";
-        static final String STABLE_SIG       = "Ljava/lang/invoke/Stable;";
+        static final String STABLE_SIG       = "Ljdk/internal/vm/annotation/Stable;";
 
         static final String SPECIES_PREFIX_NAME = "Species_";
         static final String SPECIES_PREFIX_PATH = BMH + "$" + SPECIES_PREFIX_NAME;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Fri Jan 15 19:18:42 2016 +0000
@@ -26,19 +26,23 @@
 package java.lang.invoke;
 
 import jdk.internal.misc.Unsafe;
+import jdk.internal.vm.annotation.ForceInline;
+import sun.invoke.util.ValueConversions;
+import sun.invoke.util.VerifyAccess;
+import sun.invoke.util.VerifyType;
+import sun.invoke.util.Wrapper;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.Arrays;
-import sun.invoke.util.VerifyAccess;
+import java.util.Objects;
+
+import static java.lang.invoke.LambdaForm.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
-import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.MethodHandleStatics.UNSAFE;
+import static java.lang.invoke.MethodHandleStatics.newInternalError;
 import static java.lang.invoke.MethodTypeForm.*;
-import static java.lang.invoke.MethodHandleStatics.*;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Field;
-import java.util.Objects;
-import sun.invoke.util.ValueConversions;
-import sun.invoke.util.VerifyType;
-import sun.invoke.util.Wrapper;
 
 /**
  * The flavor of method handle which implements a constant reference
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DontInline.java	Fri Jan 15 08:53:23 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2012, 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.lang.invoke;
-
-import java.lang.annotation.*;
-
-/**
- * Internal marker for some methods in the JSR 292 implementation.
- */
-/*non-public*/
-@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.RUNTIME)
-@interface DontInline {
-}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/ForceInline.java	Fri Jan 15 08:53:23 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2012, 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.lang.invoke;
-
-import java.lang.annotation.*;
-
-/**
- * Internal marker for some methods in the JSR 292 implementation.
- */
-/*non-public*/
-@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.RUNTIME)
-@interface ForceInline {
-}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Fri Jan 15 19:18:42 2016 +0000
@@ -625,9 +625,9 @@
 
         if (lambdaForm.forceInline) {
             // Force inlining of this invoker method.
-            mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
+            mv.visitAnnotation("Ljdk/internal/vm/annotation/ForceInline;", true);
         } else {
-            mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
+            mv.visitAnnotation("Ljdk/internal/vm/annotation/DontInline;", true);
         }
 
         if (lambdaForm.customized != null) {
@@ -1309,7 +1309,7 @@
         mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
 
         // Don't inline the interpreter entry.
-        mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
+        mv.visitAnnotation("Ljdk/internal/vm/annotation/DontInline;", true);
 
         // create parameter array
         emitIconstInsn(invokerType.parameterCount());
@@ -1368,7 +1368,7 @@
         mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
 
         // Force inlining of this invoker method.
-        mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
+        mv.visitAnnotation("Ljdk/internal/vm/annotation/ForceInline;", true);
 
         // Load receiver
         emitAloadInsn(0);
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Fri Jan 15 19:18:42 2016 +0000
@@ -25,6 +25,10 @@
 
 package java.lang.invoke;
 
+import jdk.internal.vm.annotation.DontInline;
+import jdk.internal.vm.annotation.ForceInline;
+import jdk.internal.vm.annotation.Stable;
+
 import java.lang.reflect.Array;
 import java.util.Arrays;
 
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Fri Jan 15 19:18:42 2016 +0000
@@ -25,18 +25,24 @@
 
 package java.lang.invoke;
 
-import java.lang.annotation.*;
+import jdk.internal.vm.annotation.DontInline;
+import jdk.internal.vm.annotation.Stable;
+import sun.invoke.util.Wrapper;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.List;
 import java.util.Arrays;
 import java.util.HashMap;
-
-import sun.invoke.util.Wrapper;
-import java.lang.reflect.Field;
+import java.util.List;
 
 import static java.lang.invoke.LambdaForm.BasicType.*;
-import static java.lang.invoke.MethodHandleStatics.*;
-import static java.lang.invoke.MethodHandleNatives.Constants.*;
+import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic;
+import static java.lang.invoke.MethodHandleStatics.debugEnabled;
+import static java.lang.invoke.MethodHandleStatics.newInternalError;
 
 /**
  * The symbolic, non-executable form of a method handle's invocation semantics.
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Jan 15 19:18:42 2016 +0000
@@ -33,6 +33,7 @@
 import java.util.List;
 import java.util.function.Function;
 
+import jdk.internal.vm.annotation.Stable;
 import sun.invoke.empty.Empty;
 import sun.invoke.util.ValueConversions;
 import sun.invoke.util.VerifyType;
@@ -1487,7 +1488,7 @@
     }
 
     private static final int LEFT_ARGS = FILL_ARRAYS_COUNT - 1;
-    private static final @Stable MethodHandle[] FILL_ARRAY_TO_RIGHT = new MethodHandle[MAX_ARITY+1];
+    private static final @Stable MethodHandle[] FILL_ARRAY_TO_RIGHT = new MethodHandle[MAX_ARITY + 1];
     /** fill_array_to_right(N).invoke(a, argL..arg[N-1])
      *  fills a[L]..a[N-1] with corresponding arguments,
      *  and then returns a.  The value L is a global constant (LEFT_ARGS).
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Fri Jan 15 19:18:42 2016 +0000
@@ -1836,7 +1836,7 @@
                 return false;
             }
             ClassLoader loader = defc.getClassLoader();
-            if (!sun.misc.VM.isSystemDomainLoader(loader)) {
+            if (!jdk.internal.misc.VM.isSystemDomainLoader(loader)) {
                 ClassLoader sysl = ClassLoader.getSystemClassLoader();
                 boolean found = false;
                 while (sysl != null) {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java	Fri Jan 15 19:18:42 2016 +0000
@@ -25,6 +25,7 @@
 
 package java.lang.invoke;
 
+import jdk.internal.vm.annotation.Stable;
 import sun.invoke.util.Wrapper;
 import java.lang.ref.WeakReference;
 import java.lang.ref.Reference;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java	Fri Jan 15 19:18:42 2016 +0000
@@ -25,6 +25,7 @@
 
 package java.lang.invoke;
 
+import jdk.internal.vm.annotation.Stable;
 import sun.invoke.util.Wrapper;
 import java.lang.ref.SoftReference;
 import static java.lang.invoke.MethodHandleStatics.*;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Stable.java	Fri Jan 15 08:53:23 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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.lang.invoke;
-
-import java.lang.annotation.*;
-
-/**
- * A field may be annotated as stable if all of its component variables
- * changes value at most once.
- * A field's value counts as its component value.
- * If the field is typed as an array, then all the non-null components
- * of the array, of depth up to the rank of the field's array type,
- * also count as component values.
- * By extension, any variable (either array or field) which has annotated
- * as stable is called a stable variable, and its non-null or non-zero
- * value is called a stable value.
- * <p>
- * Since all fields begin with a default value of null for references
- * (resp., zero for primitives), it follows that this annotation indicates
- * that the first non-null (resp., non-zero) value stored in the field
- * will never be changed.
- * <p>
- * If the field is not of an array type, there are no array elements,
- * then the value indicated as stable is simply the value of the field.
- * If the dynamic type of the field value is an array but the static type
- * is not, the components of the array are <em>not</em> regarded as stable.
- * <p>
- * If the field is an array type, then both the field value and
- * all the components of the field value (if the field value is non-null)
- * are indicated to be stable.
- * If the field type is an array type with rank {@code N > 1},
- * then each component of the field value (if the field value is non-null),
- * is regarded as a stable array of rank {@code N-1}.
- * <p>
- * Fields which are declared {@code final} may also be annotated as stable.
- * Since final fields already behave as stable values, such an annotation
- * indicates no additional information, unless the type of the field is
- * an array type.
- * <p>
- * It is (currently) undefined what happens if a field annotated as stable
- * is given a third value.  In practice, if the JVM relies on this annotation
- * to promote a field reference to a constant, it may be that the Java memory
- * model would appear to be broken, if such a constant (the second value of the field)
- * is used as the value of the field even after the field value has changed.
- */
-/* package-private */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-@interface Stable {
-}
--- a/jdk/src/java.base/share/classes/java/lang/ref/Cleaner.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Cleaner.java	Fri Jan 15 19:18:42 2016 +0000
@@ -28,7 +28,7 @@
 import java.util.Objects;
 import java.util.concurrent.ThreadFactory;
 
-import jdk.internal.misc.CleanerImpl;
+import jdk.internal.ref.CleanerImpl;
 
 /**
  * {@code Cleaner} manages a set of object references and corresponding cleaning actions.
--- a/jdk/src/java.base/share/classes/java/lang/ref/Finalizer.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Finalizer.java	Fri Jan 15 19:18:42 2016 +0000
@@ -29,7 +29,7 @@
 import java.security.AccessController;
 import jdk.internal.misc.JavaLangAccess;
 import jdk.internal.misc.SharedSecrets;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 final class Finalizer extends FinalReference<Object> { /* Package-private; must be in
                                                           same package as the Reference
--- a/jdk/src/java.base/share/classes/java/lang/ref/Reference.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Reference.java	Fri Jan 15 19:18:42 2016 +0000
@@ -25,6 +25,7 @@
 
 package java.lang.ref;
 
+import jdk.internal.vm.annotation.DontInline;
 import sun.misc.Cleaner;
 import jdk.internal.HotSpotIntrinsicCandidate;
 import jdk.internal.misc.JavaLangRefAccess;
@@ -310,4 +311,120 @@
         this.queue = (queue == null) ? ReferenceQueue.NULL : queue;
     }
 
+    /**
+     * Ensures that the object referenced by the given reference remains
+     * <a href="package-summary.html#reachability"><em>strongly reachable</em></a>,
+     * regardless of any prior actions of the program that might otherwise cause
+     * the object to become unreachable; thus, the referenced object is not
+     * reclaimable by garbage collection at least until after the invocation of
+     * this method.  Invocation of this method does not itself initiate garbage
+     * collection or finalization.
+     *
+     * <p> This method establishes an ordering for
+     * <a href="package-summary.html#reachability"><em>strong reachability</em></a>
+     * with respect to garbage collection.  It controls relations that are
+     * otherwise only implicit in a program -- the reachability conditions
+     * triggering garbage collection.  This method is designed for use in
+     * uncommon situations of premature finalization where using
+     * {@code synchronized} blocks or methods, or using other synchronization
+     * facilities are not possible or do not provide the desired control.  This
+     * method is applicable only when reclamation may have visible effects,
+     * which is possible for objects with finalizers (See
+     * <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.6">
+     * Section 12.6 17 of <cite>The Java&trade; Language Specification</cite></a>)
+     * that are implemented in ways that rely on ordering control for correctness.
+     *
+     * @apiNote
+     * Finalization may occur whenever the virtual machine detects that no
+     * reference to an object will ever be stored in the heap: The garbage
+     * collector may reclaim an object even if the fields of that object are
+     * still in use, so long as the object has otherwise become unreachable.
+     * This may have surprising and undesirable effects in cases such as the
+     * following example in which the bookkeeping associated with a class is
+     * managed through array indices.  Here, method {@code action} uses a
+     * {@code reachabilityFence} to ensure that the {@code Resource} object is
+     * not reclaimed before bookkeeping on an associated
+     * {@code ExternalResource} has been performed; in particular here, to
+     * ensure that the array slot holding the {@code ExternalResource} is not
+     * nulled out in method {@link Object#finalize}, which may otherwise run
+     * concurrently.
+     *
+     * <pre> {@code
+     * class Resource {
+     *   private static ExternalResource[] externalResourceArray = ...
+     *
+     *   int myIndex;
+     *   Resource(...) {
+     *     myIndex = ...
+     *     externalResourceArray[myIndex] = ...;
+     *     ...
+     *   }
+     *   protected void finalize() {
+     *     externalResourceArray[myIndex] = null;
+     *     ...
+     *   }
+     *   public void action() {
+     *     try {
+     *       // ...
+     *       int i = myIndex;
+     *       Resource.update(externalResourceArray[i]);
+     *     } finally {
+     *       Reference.reachabilityFence(this);
+     *     }
+     *   }
+     *   private static void update(ExternalResource ext) {
+     *     ext.status = ...;
+     *   }
+     * }}</pre>
+     *
+     * Here, the invocation of {@code reachabilityFence} is nonintuitively
+     * placed <em>after</em> the call to {@code update}, to ensure that the
+     * array slot is not nulled out by {@link Object#finalize} before the
+     * update, even if the call to {@code action} was the last use of this
+     * object.  This might be the case if, for example a usage in a user program
+     * had the form {@code new Resource().action();} which retains no other
+     * reference to this {@code Resource}.  While probably overkill here,
+     * {@code reachabilityFence} is placed in a {@code finally} block to ensure
+     * that it is invoked across all paths in the method.  In a method with more
+     * complex control paths, you might need further precautions to ensure that
+     * {@code reachabilityFence} is encountered along all of them.
+     *
+     * <p> It is sometimes possible to better encapsulate use of
+     * {@code reachabilityFence}.  Continuing the above example, if it were
+     * acceptable for the call to method {@code update} to proceed even if the
+     * finalizer had already executed (nulling out slot), then you could
+     * localize use of {@code reachabilityFence}:
+     *
+     * <pre> {@code
+     * public void action2() {
+     *   // ...
+     *   Resource.update(getExternalResource());
+     * }
+     * private ExternalResource getExternalResource() {
+     *   ExternalResource ext = externalResourceArray[myIndex];
+     *   Reference.reachabilityFence(this);
+     *   return ext;
+     * }}</pre>
+     *
+     * <p> Method {@code reachabilityFence} is not required in constructions
+     * that themselves ensure reachability.  For example, because objects that
+     * are locked cannot, in general, be reclaimed, it would suffice if all
+     * accesses of the object, in all methods of class {@code Resource}
+     * (including {@code finalize}) were enclosed in {@code synchronized (this)}
+     * blocks.  (Further, such blocks must not include infinite loops, or
+     * themselves be unreachable, which fall into the corner case exceptions to
+     * the "in general" disclaimer.)  However, method {@code reachabilityFence}
+     * remains a better option in cases where this approach is not as efficient,
+     * desirable, or possible; for example because it would encounter deadlock.
+     *
+     * @param ref the reference. If {@code null}, this method has no effect.
+     * @since 9
+     */
+    @DontInline
+    public static void reachabilityFence(Object ref) {
+        // Does nothing, because this method is annotated with @DontInline
+        // HotSpot needs to retain the ref and not GC it before a call to this
+        // method
+    }
+
 }
--- a/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java	Fri Jan 15 19:18:42 2016 +0000
@@ -26,6 +26,7 @@
 package java.lang.ref;
 
 import java.util.function.Consumer;
+import jdk.internal.misc.VM;
 
 /**
  * Reference queues, to which registered reference objects are appended by the
@@ -73,7 +74,7 @@
             // Volatiles ensure ordering.
             r.queue = ENQUEUED;
             if (r instanceof FinalReference) {
-                sun.misc.VM.addFinalRefCount(1);
+                VM.addFinalRefCount(1);
             }
             lock.notifyAll();
             return true;
@@ -93,7 +94,7 @@
             r.next = r;
             queueLength--;
             if (r instanceof FinalReference) {
-                sun.misc.VM.addFinalRefCount(-1);
+                VM.addFinalRefCount(-1);
             }
             return r;
         }
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java	Fri Jan 15 19:18:42 2016 +0000
@@ -34,7 +34,7 @@
 import java.util.Objects;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.BiFunction;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
--- a/jdk/src/java.base/share/classes/java/net/URI.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/URI.java	Fri Jan 15 19:18:42 2016 +0000
@@ -1146,13 +1146,30 @@
         if (part != null) {
             return part;
         }
-        StringBuilder sb = new StringBuilder();
-        appendSchemeSpecificPart(sb, null, getAuthority(), getUserInfo(),
+
+        String s = string;
+        if (s != null) {
+            // if string is defined, components will have been parsed
+            int start = 0;
+            int end = s.length();
+            if (scheme != null) {
+                start = scheme.length() + 1;
+            }
+            if (fragment != null) {
+                end -= fragment.length() + 1;
+            }
+            if (path != null && path.length() == end - start) {
+                part = path;
+            } else {
+                part = s.substring(start, end);
+            }
+        } else {
+            StringBuilder sb = new StringBuilder();
+            appendSchemeSpecificPart(sb, null, getAuthority(), getUserInfo(),
                                  host, port, getPath(), getQuery());
-        if (sb.length() == 0) {
-            return null;
+            part = sb.toString();
         }
-        return schemeSpecificPart = sb.toString();
+        return schemeSpecificPart = part;
     }
 
     /**
@@ -2059,7 +2076,7 @@
 
         // 5.2 (2): Reference to current document (lone fragment)
         if ((child.scheme == null) && (child.authority == null)
-            && child.path.equals("") && (child.fragment != null)
+            && child.path.isEmpty() && (child.fragment != null)
             && (child.query == null)) {
             if ((base.fragment != null)
                 && child.fragment.equals(base.fragment)) {
@@ -2647,13 +2664,6 @@
     private static final long L_SCHEME = L_ALPHA | L_DIGIT | lowMask("+-.");
     private static final long H_SCHEME = H_ALPHA | H_DIGIT | highMask("+-.");
 
-    // uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" |
-    //                 "&" | "=" | "+" | "$" | ","
-    private static final long L_URIC_NO_SLASH
-        = L_UNRESERVED | L_ESCAPED | lowMask(";?:@&=+$,");
-    private static final long H_URIC_NO_SLASH
-        = H_UNRESERVED | H_ESCAPED | highMask(";?:@&=+$,");
-
     // scope_id = alpha | digit | "_" | "."
     private static final long L_SCOPE_ID
         = L_ALPHANUM | lowMask("_.");
@@ -2884,23 +2894,10 @@
 
         // -- Simple access to the input string --
 
-        // Return a substring of the input string
-        //
-        private String substring(int start, int end) {
-            return input.substring(start, end);
-        }
-
-        // Return the char at position p,
-        // assuming that p < input.length()
-        //
-        private char charAt(int p) {
-            return input.charAt(p);
-        }
-
         // Tells whether start < end and, if so, whether charAt(start) == c
         //
         private boolean at(int start, int end, char c) {
-            return (start < end) && (charAt(start) == c);
+            return (start < end) && (input.charAt(start) == c);
         }
 
         // Tells whether start + s.length() < end and, if so,
@@ -2913,7 +2910,7 @@
                 return false;
             int i = 0;
             while (i < sn) {
-                if (charAt(p++) != s.charAt(i)) {
+                if (input.charAt(p++) != s.charAt(i)) {
                     break;
                 }
                 i++;
@@ -2953,7 +2950,7 @@
         // start position.
         //
         private int scan(int start, int end, char c) {
-            if ((start < end) && (charAt(start) == c))
+            if ((start < end) && (input.charAt(start) == c))
                 return start + 1;
             return start;
         }
@@ -2968,7 +2965,7 @@
         private int scan(int start, int end, String err, String stop) {
             int p = start;
             while (p < end) {
-                char c = charAt(p);
+                char c = input.charAt(p);
                 if (err.indexOf(c) >= 0)
                     return -1;
                 if (stop.indexOf(c) >= 0)
@@ -2978,6 +2975,23 @@
             return p;
         }
 
+        // Scan forward from the given start position.  Stop at the first char
+        // in the stop string (in which case the index of the preceding char is
+        // returned), or the end of the input string (in which case the length
+        // of the input string is returned).  May return the start position if
+        // nothing matches.
+        //
+        private int scan(int start, int end, String stop) {
+            int p = start;
+            while (p < end) {
+                char c = input.charAt(p);
+                if (stop.indexOf(c) >= 0)
+                    break;
+                p++;
+            }
+            return p;
+        }
+
         // Scan a potential escape sequence, starting at the given position,
         // with the given first char (i.e., charAt(start) == c).
         //
@@ -2992,8 +3006,8 @@
             if (c == '%') {
                 // Process escape pair
                 if ((p + 3 <= n)
-                    && match(charAt(p + 1), L_HEX, H_HEX)
-                    && match(charAt(p + 2), L_HEX, H_HEX)) {
+                    && match(input.charAt(p + 1), L_HEX, H_HEX)
+                    && match(input.charAt(p + 2), L_HEX, H_HEX)) {
                     return p + 3;
                 }
                 fail("Malformed escape pair", p);
@@ -3013,7 +3027,7 @@
         {
             int p = start;
             while (p < n) {
-                char c = charAt(p);
+                char c = input.charAt(p);
                 if (match(c, lowMask, highMask)) {
                     p++;
                     continue;
@@ -3059,7 +3073,6 @@
         //
         void parse(boolean rsa) throws URISyntaxException {
             requireServerAuthority = rsa;
-            int ssp;                    // Start of scheme-specific part
             int n = input.length();
             int p = scan(0, n, "/?#", ":");
             if ((p >= 0) && at(p, n, ':')) {
@@ -3067,26 +3080,25 @@
                     failExpecting("scheme name", 0);
                 checkChar(0, L_ALPHA, H_ALPHA, "scheme name");
                 checkChars(1, p, L_SCHEME, H_SCHEME, "scheme name");
-                scheme = substring(0, p);
+                scheme = input.substring(0, p);
                 p++;                    // Skip ':'
-                ssp = p;
                 if (at(p, n, '/')) {
                     p = parseHierarchical(p, n);
                 } else {
-                    int q = scan(p, n, "", "#");
+                    // opaque; need to create the schemeSpecificPart
+                    int q = scan(p, n, "#");
                     if (q <= p)
                         failExpecting("scheme-specific part", p);
                     checkChars(p, q, L_URIC, H_URIC, "opaque part");
+                    schemeSpecificPart = input.substring(p, q);
                     p = q;
                 }
             } else {
-                ssp = 0;
                 p = parseHierarchical(0, n);
             }
-            schemeSpecificPart = substring(ssp, p);
             if (at(p, n, '#')) {
                 checkChars(p + 1, n, L_URIC, H_URIC, "fragment");
-                fragment = substring(p + 1, n);
+                fragment = input.substring(p + 1, n);
                 p = n;
             }
             if (p < n)
@@ -3113,7 +3125,7 @@
             int p = start;
             if (at(p, n, '/') && at(p + 1, n, '/')) {
                 p += 2;
-                int q = scan(p, n, "", "/?#");
+                int q = scan(p, n, "/?#");
                 if (q > p) {
                     p = parseAuthority(p, q);
                 } else if (q < n) {
@@ -3122,15 +3134,15 @@
                 } else
                     failExpecting("authority", p);
             }
-            int q = scan(p, n, "", "?#"); // DEVIATION: May be empty
+            int q = scan(p, n, "?#"); // DEVIATION: May be empty
             checkChars(p, q, L_PATH, H_PATH, "path");
-            path = substring(p, q);
+            path = input.substring(p, q);
             p = q;
             if (at(p, n, '?')) {
                 p++;
-                q = scan(p, n, "", "#");
+                q = scan(p, n, "#");
                 checkChars(p, q, L_URIC, H_URIC, "query");
-                query = substring(p, q);
+                query = input.substring(p, q);
                 p = q;
             }
             return p;
@@ -3154,7 +3166,7 @@
             boolean serverChars;
             boolean regChars;
 
-            if (scan(p, n, "", "]") > p) {
+            if (scan(p, n, "]") > p) {
                 // contains a literal IPv6 address, therefore % is allowed
                 serverChars = (scan(p, n, L_SERVER_PERCENT, H_SERVER_PERCENT) == n);
             } else {
@@ -3164,7 +3176,7 @@
 
             if (regChars && !serverChars) {
                 // Must be a registry-based authority
-                authority = substring(p, n);
+                authority = input.substring(p, n);
                 return n;
             }
 
@@ -3176,7 +3188,7 @@
                     q = parseServer(p, n);
                     if (q < n)
                         failExpecting("end of authority", q);
-                    authority = substring(p, n);
+                    authority = input.substring(p, n);
                 } catch (URISyntaxException x) {
                     // Undo results of failed parse
                     userInfo = null;
@@ -3198,7 +3210,7 @@
             if (q < n) {
                 if (regChars) {
                     // Registry-based authority
-                    authority = substring(p, n);
+                    authority = input.substring(p, n);
                 } else if (ex != null) {
                     // Re-throw exception; it was probably due to
                     // a malformed IPv6 address
@@ -3224,7 +3236,7 @@
             q = scan(p, n, "/?#", "@");
             if ((q >= p) && at(q, n, '@')) {
                 checkChars(p, q, L_USERINFO, H_USERINFO, "user info");
-                userInfo = substring(p, q);
+                userInfo = input.substring(p, q);
                 p = q + 1;              // Skip '@'
             }
 
@@ -3235,7 +3247,7 @@
                 q = scan(p, n, "/?#", "]");
                 if ((q > p) && at(q, n, ']')) {
                     // look for a "%" scope id
-                    int r = scan (p, q, "", "%");
+                    int r = scan (p, q, "%");
                     if (r > p) {
                         parseIPv6Reference(p, r);
                         if (r+1 == q) {
@@ -3246,7 +3258,7 @@
                     } else {
                         parseIPv6Reference(p, q);
                     }
-                    host = substring(p-1, q+1);
+                    host = input.substring(p-1, q+1);
                     p = q + 1;
                 } else {
                     failExpecting("closing bracket for IPv6 address", q);
@@ -3261,7 +3273,7 @@
             // port
             if (at(p, n, ':')) {
                 p++;
-                q = scan(p, n, "", "/");
+                q = scan(p, n, "/");
                 if (q > p) {
                     checkChars(p, q, L_DIGIT, H_DIGIT, "port number");
                     try {
@@ -3361,13 +3373,13 @@
                 // IPv4 address is followed by something - check that
                 // it's a ":" as this is the only valid character to
                 // follow an address.
-                if (charAt(p) != ':') {
+                if (input.charAt(p) != ':') {
                     p = -1;
                 }
             }
 
             if (p > start)
-                host = substring(start, p);
+                host = input.substring(start, p);
 
             return p;
         }
@@ -3393,7 +3405,7 @@
                     p = q;
                     q = scan(p, n, L_ALPHANUM | L_DASH, H_ALPHANUM | H_DASH);
                     if (q > p) {
-                        if (charAt(q - 1) == '-')
+                        if (input.charAt(q - 1) == '-')
                             fail("Illegal character in hostname", q - 1);
                         p = q;
                     }
@@ -3412,11 +3424,11 @@
 
             // for a fully qualified hostname check that the rightmost
             // label starts with an alpha character.
-            if (l > start && !match(charAt(l), L_ALPHA, H_ALPHA)) {
+            if (l > start && !match(input.charAt(l), L_ALPHA, H_ALPHA)) {
                 fail("Illegal character in hostname", l);
             }
 
-            host = substring(start, p);
+            host = input.substring(start, p);
             return p;
         }
 
--- a/jdk/src/java.base/share/classes/java/net/URL.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/URL.java	Fri Jan 15 19:18:42 2016 +0000
@@ -1242,7 +1242,7 @@
     private static ThreadLocal<Object> gate = new ThreadLocal<>();
 
     private static URLStreamHandler lookupViaProviders(final String protocol) {
-        if (!sun.misc.VM.isBooted())
+        if (!jdk.internal.misc.VM.isBooted())
             return null;
 
         if (gate.get() != null)
--- a/jdk/src/java.base/share/classes/java/net/URLConnection.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/URLConnection.java	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -1567,6 +1567,11 @@
             }
         }
 
+        if ((c1 == 0x49 && c2 == 0x49 && c3 == 0x2a && c4 == 0x00)
+            || (c1 == 0x4d && c2 == 0x4d && c3 == 0x00 && c4 == 0x2a)) {
+            return "image/tiff";
+        }
+
         if (c1 == 0xD0 && c2 == 0xCF && c3 == 0x11 && c4 == 0xE0 &&
             c5 == 0xA1 && c6 == 0xB1 && c7 == 0x1A && c8 == 0xE1) {
 
--- a/jdk/src/java.base/share/classes/java/nio/Bits.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/Bits.java	Fri Jan 15 19:18:42 2016 +0000
@@ -31,7 +31,7 @@
 import jdk.internal.misc.JavaLangRefAccess;
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.misc.Unsafe;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 /**
  * Access to bits, native and otherwise.
--- a/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Fri Jan 15 19:18:42 2016 +0000
@@ -30,7 +30,7 @@
 import java.io.FileDescriptor;
 import sun.misc.Cleaner;
 import jdk.internal.misc.Unsafe;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 import sun.nio.ch.DirectBuffer;
 
 
--- a/jdk/src/java.base/share/classes/java/nio/charset/Charset.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset.java	Fri Jan 15 19:18:42 2016 +0000
@@ -43,6 +43,7 @@
 import java.util.ServiceConfigurationError;
 import java.util.SortedMap;
 import java.util.TreeMap;
+import jdk.internal.misc.VM;
 import sun.misc.ASCIICaseInsensitiveComparator;
 import sun.nio.cs.StandardCharsets;
 import sun.nio.cs.ThreadLocalCoders;
@@ -281,7 +282,7 @@
     static boolean atBugLevel(String bl) {              // package-private
         String level = bugLevel;
         if (level == null) {
-            if (!sun.misc.VM.isBooted())
+            if (!VM.isBooted())
                 return false;
             bugLevel = level = AccessController.doPrivileged(
                 new GetPropertyAction("sun.nio.cs.bugLevel", ""));
@@ -394,7 +395,7 @@
         // that loader to be prematurely initialized with incomplete
         // information.
         //
-        if (!sun.misc.VM.isBooted())
+        if (!VM.isBooted())
             return null;
 
         if (gate.get() != null)
@@ -445,7 +446,7 @@
     }
 
     private static Charset lookupExtendedCharset(String charsetName) {
-        if (!sun.misc.VM.isBooted())  // see lookupViaProviders()
+        if (!VM.isBooted())  // see lookupViaProviders()
             return null;
         CharsetProvider[] ecps = ExtendedProviderHolder.extendedProviders;
         for (CharsetProvider cp : ecps) {
--- a/jdk/src/java.base/share/classes/java/time/Clock.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/time/Clock.java	Fri Jan 15 19:18:42 2016 +0000
@@ -69,7 +69,7 @@
 import java.io.Serializable;
 import java.util.Objects;
 import java.util.TimeZone;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 /**
  * A clock providing access to the current instant, date and time using a time-zone.
--- a/jdk/src/java.base/share/classes/java/time/LocalDate.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/time/LocalDate.java	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -1369,6 +1369,23 @@
         if (daysToAdd == 0) {
             return this;
         }
+        long dom = day + daysToAdd;
+        if (dom > 0) {
+            if (dom <= 28) {
+                return new LocalDate(year, month, (int) dom);
+            } else if (dom <= 59) { // 59th Jan is 28th Feb, 59th Feb is 31st Mar
+                long monthLen = lengthOfMonth();
+                if (dom <= monthLen) {
+                    return new LocalDate(year, month, (int) dom);
+                } else if (month < 12) {
+                    return new LocalDate(year, month + 1, (int) (dom - monthLen));
+                } else {
+                    YEAR.checkValidValue(year + 1);
+                    return new LocalDate(year + 1, 1, (int) (dom - monthLen));
+                }
+            }
+        }
+
         long mjDay = Math.addExact(toEpochDay(), daysToAdd);
         return LocalDate.ofEpochDay(mjDay);
     }
--- a/jdk/src/java.base/share/classes/java/util/Arrays.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Arrays.java	Fri Jan 15 19:18:42 2016 +0000
@@ -110,7 +110,7 @@
      * Checks that {@code fromIndex} and {@code toIndex} are in
      * the range and throws an exception if they aren't.
      */
-    private static void rangeCheck(int arrayLength, int fromIndex, int toIndex) {
+    static void rangeCheck(int arrayLength, int fromIndex, int toIndex) {
         if (fromIndex > toIndex) {
             throw new IllegalArgumentException(
                     "fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
@@ -2579,11 +2579,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (a[i] != a2[i])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -2628,11 +2624,9 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++)
-            if (a[aFromIndex++] != b[bFromIndex++])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex,
+                                      aLength) < 0;
     }
 
     /**
@@ -2657,11 +2651,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (a[i] != a2[i])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -2706,11 +2696,9 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++)
-            if (a[aFromIndex++] != b[bFromIndex++])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex,
+                                      aLength) < 0;
     }
 
     /**
@@ -2735,11 +2723,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (a[i] != a2[i])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -2784,11 +2768,9 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++)
-            if (a[aFromIndex++] != b[bFromIndex++])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex,
+                                      aLength) < 0;
     }
 
     /**
@@ -2814,11 +2796,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (a[i] != a2[i])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -2863,11 +2841,9 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++)
-            if (a[aFromIndex++] != b[bFromIndex++])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex,
+                                      aLength) < 0;
     }
 
     /**
@@ -2893,11 +2869,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (a[i] != a2[i])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -2942,11 +2914,9 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++)
-            if (a[aFromIndex++] != b[bFromIndex++])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex,
+                                      aLength) < 0;
     }
 
     /**
@@ -2971,11 +2941,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (a[i] != a2[i])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -3020,11 +2986,9 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++)
-            if (a[aFromIndex++] != b[bFromIndex++])
-                return false;
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex,
+                                      aLength) < 0;
     }
 
     /**
@@ -3055,14 +3019,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++) {
-            double v1 = a[i], v2 = a2[i];
-            if (Double.doubleToRawLongBits(v1) != Double.doubleToRawLongBits(v2))
-                if (!Double.isNaN(v1) || !Double.isNaN(v2))
-                    return false;
-        }
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -3113,14 +3070,8 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++) {
-            Double va = a[aFromIndex++], vb = b[bFromIndex++];
-            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
-                if (!Double.isNaN(va) || !Double.isNaN(vb))
-                    return false;
-        }
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex, aLength) < 0;
     }
 
     /**
@@ -3151,14 +3102,7 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++) {
-            float v1 = a[i], v2 = a2[i];
-            if (Float.floatToRawIntBits(v1) != Float.floatToRawIntBits(v2))
-                if (!Float.isNaN(v1) || !Float.isNaN(v2))
-                    return false;
-        }
-
-        return true;
+        return ArraysSupport.mismatch(a, a2, length) < 0;
     }
 
     /**
@@ -3209,14 +3153,8 @@
         if (aLength != bLength)
             return false;
 
-        for (int i = 0; i < aLength; i++) {
-            float va = a[aFromIndex++], vb = b[bFromIndex++];
-            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
-                if (!Float.isNaN(va) || !Float.isNaN(vb))
-                    return false;
-        }
-
-        return true;
+        return ArraysSupport.mismatch(a, aFromIndex,
+                                      b, bFromIndex, aLength) < 0;
     }
 
     /**
@@ -5804,9 +5742,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Boolean.compare(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Boolean.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -5880,11 +5819,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            boolean va = a[aFromIndex++];
-            boolean vb = b[bFromIndex++];
-            if (va != vb) return Boolean.compare(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Boolean.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -5939,9 +5878,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Byte.compare(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Byte.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6014,11 +5954,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            byte va = a[aFromIndex++];
-            byte vb = b[bFromIndex++];
-            if (va != vb) return Byte.compare(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Byte.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6066,9 +6006,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Byte.compareUnsigned(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Byte.compareUnsigned(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6133,11 +6074,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            byte va = a[aFromIndex++];
-            byte vb = b[bFromIndex++];
-            if (va != vb) return Byte.compareUnsigned(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Byte.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6192,9 +6133,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Short.compare(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Short.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6267,11 +6209,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            short va = a[aFromIndex++];
-            short vb = b[bFromIndex++];
-            if (va != vb) return Short.compare(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Short.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6319,9 +6261,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Short.compareUnsigned(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Short.compareUnsigned(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6385,11 +6328,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            short va = a[aFromIndex++];
-            short vb = b[bFromIndex++];
-            if (va != vb) return Short.compareUnsigned(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Short.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6444,9 +6387,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Character.compare(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Character.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6519,11 +6463,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            char va = a[aFromIndex++];
-            char vb = b[bFromIndex++];
-            if (va != vb) return Character.compare(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Character.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6578,9 +6522,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Integer.compare(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Integer.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6653,11 +6598,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            int va = a[aFromIndex++];
-            int vb = b[bFromIndex++];
-            if (va != vb) return Integer.compare(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Integer.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6705,9 +6650,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Integer.compareUnsigned(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Integer.compareUnsigned(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6771,11 +6717,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            int va = a[aFromIndex++];
-            int vb = b[bFromIndex++];
-            if (va != vb) return Integer.compareUnsigned(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Integer.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6830,9 +6776,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Long.compare(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Long.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -6905,11 +6852,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            long va = a[aFromIndex++];
-            long vb = b[bFromIndex++];
-            if (va != vb) return Long.compare(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Long.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -6957,9 +6904,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return Long.compareUnsigned(a[i], b[i]);
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Long.compareUnsigned(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -7023,11 +6971,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            long va = a[aFromIndex++];
-            long vb = b[bFromIndex++];
-            if (va != vb) return Long.compareUnsigned(va, vb);
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Long.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -7082,13 +7030,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            float va = a[i], vb = b[i];
-            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb)) {
-                int c = Float.compare(va, vb);
-                if (c != 0) return c;
-            }
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Float.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -7161,13 +7106,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            float va = a[aFromIndex++], vb = b[bFromIndex++];
-            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb)) {
-                int c = Float.compare(va, vb);
-                if (c != 0) return c;
-            }
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Float.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -7222,13 +7165,10 @@
         if (a == null || b == null)
             return a == null ? -1 : 1;
 
-        int length = Math.min(a.length, b.length);
-        for (int i = 0; i < length; i++) {
-            double va = a[i], vb = b[i];
-            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb)) {
-                int c = Double.compare(va, vb);
-                if (c != 0) return c;
-            }
+        int i = ArraysSupport.mismatch(a, b,
+                                       Math.min(a.length, b.length));
+        if (i >= 0) {
+            return Double.compare(a[i], b[i]);
         }
 
         return a.length - b.length;
@@ -7301,13 +7241,11 @@
 
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
-        int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            double va = a[aFromIndex++], vb = b[bFromIndex++];
-            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb)) {
-                int c = Double.compare(va, vb);
-                if (c != 0) return c;
-            }
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       Math.min(aLength, bLength));
+        if (i >= 0) {
+            return Double.compare(a[aFromIndex + i], b[bFromIndex + i]);
         }
 
         return aLength - bLength;
@@ -7673,11 +7611,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -7749,11 +7684,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            if (a[aFromIndex++] != b[bFromIndex++]) return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch byte
@@ -7804,11 +7738,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -7880,11 +7811,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            if (a[aFromIndex++] != b[bFromIndex++]) return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch char
@@ -7935,11 +7865,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -8011,11 +7938,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            if (a[aFromIndex++] != b[bFromIndex++]) return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch short
@@ -8066,11 +7992,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -8142,11 +8065,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            if (a[aFromIndex++] != b[bFromIndex++]) return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch int
@@ -8197,11 +8119,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -8273,11 +8192,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            if (a[aFromIndex++] != b[bFromIndex++]) return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch long
@@ -8328,11 +8246,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            if (a[i] != b[i]) return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -8404,11 +8319,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            if (a[aFromIndex++] != b[bFromIndex++]) return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch float
@@ -8459,14 +8373,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            float va = a[i], vb = b[i];
-            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
-                if (!Float.isNaN(va) || !Float.isNaN(vb))
-                    return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -8538,14 +8446,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            float va = a[aFromIndex++], vb = b[bFromIndex++];
-            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
-                if (!Float.isNaN(va) || !Float.isNaN(vb))
-                    return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch double
@@ -8596,14 +8500,8 @@
         if (a == b)
             return -1;
 
-        for (int i = 0; i < length; i++) {
-            double va = a[i], vb = b[i];
-            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
-                if (!Double.isNaN(va) || !Double.isNaN(vb))
-                    return i;
-        }
-
-        return a.length != b.length ? length : -1;
+        int i = ArraysSupport.mismatch(a, b, length);
+        return (i < 0 && a.length != b.length) ? length : i;
     }
 
     /**
@@ -8675,14 +8573,10 @@
         int aLength = aToIndex - aFromIndex;
         int bLength = bToIndex - bFromIndex;
         int length = Math.min(aLength, bLength);
-        for (int i = 0; i < length; i++) {
-            double va = a[aFromIndex++], vb = b[bFromIndex++];
-            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
-                if (!Double.isNaN(va) || !Double.isNaN(vb))
-                    return i;
-        }
-
-        return aLength != bLength ? length : -1;
+        int i = ArraysSupport.mismatch(a, aFromIndex,
+                                       b, bFromIndex,
+                                       length);
+        return (i < 0 && aLength != bLength) ? length : i;
     }
 
     // Mismatch objects
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/util/ArraysSupport.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,545 @@
+/*
+ * 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/jdk/src/java.base/share/classes/jdk/Exported.java	Fri Jan 15 08:53:23 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  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;
-
-import java.lang.annotation.*;
-
-/**
-  * Indicates whether or not a JDK specific type or package is an
-  * exported part of the JDK suitable for use outside of the JDK
-  * implementation itself.
-  *
-  * This annotation should only be applied to types and packages
-  * <em>outside</em> of the Java SE namespaces of {@code java.*} and
-  * {@code javax.*} packages.  For example, certain portions of {@code
-  * com.sun.*} are official parts of the JDK meant to be generally
-  * usable while other portions of {@code com.sun.*} are not.  This
-  * annotation type allows those portions to be easily and
-  * programmatically distinguished.
-  *
-  * <p>If in one release a type or package is
-  * <code>@Exported(true)</code>, in a subsequent major release such a
-  * type or package can transition to <code>@Exported(false)</code>.
-  *
-  * <p>If a type or package is <code>@Exported(false)</code> in a
-  * release, it may be removed in a subsequent major release.
-  *
-  * <p>If a top-level type has an <code>@Exported</code> annotation,
-  * any nested member types with the top-level type should have an
-  * <code>@Exported</code> annotation with the same value.
-  *
-  * (In exceptional cases, if a nested type is going to be removed
-  * before its enclosing type, the nested type's could be
-  * <code>@Exported(false)</code> while its enclosing type was
-  * <code>@Exported(true)</code>.)
-  *
-  * Likewise, if a package has an <code>@Exported</code> annotation,
-  * top-level types within that package should also have an
-  * <code>@Exported</code> annotation.
-  *
-  * Sometimes a top-level type may have a different
-  * <code>@Exported</code> value than its package.
-  *
-  * @since 1.8
-  */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE, ElementType.PACKAGE})
-@Exported
-public @interface Exported {
-    /**
-     * Whether or not the annotated type or package is an exported
-     * part of the JDK.
-     * @return whether or not the annotated type or package is an exported
-     * part of the JDK
-     */
-    boolean value() default true;
-}
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java	Fri Jan 15 19:18:42 2016 +0000
@@ -48,7 +48,7 @@
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import sun.misc.InnocuousThread;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 import sun.util.logging.PlatformLogger;
 import jdk.internal.logger.LazyLoggers.LazyLoggerAccessor;
 
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java	Fri Jan 15 19:18:42 2016 +0000
@@ -32,7 +32,7 @@
 import java.lang.System.Logger;
 import java.lang.ref.WeakReference;
 import java.util.Objects;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 import sun.util.logging.PlatformLogger;
 
 /**
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/CleanerImpl.java	Fri Jan 15 08:53:23 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,788 +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 jdk.internal.misc;
-
-import java.lang.ref.Cleaner;
-import java.lang.ref.Cleaner.Cleanable;
-import java.lang.ref.PhantomReference;
-import java.lang.ref.Reference;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.SoftReference;
-import java.lang.ref.WeakReference;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Objects;
-import java.util.concurrent.ThreadFactory;
-import java.util.function.Function;
-
-import sun.misc.InnocuousThread;
-
-/**
- * CleanerImpl manages a set of object references and corresponding cleaning actions.
- * CleanerImpl provides the functionality of {@link java.lang.ref.Cleaner}.
- */
-public final class CleanerImpl implements Runnable {
-
-    /**
-     * An object to access the CleanerImpl from a Cleaner; set by Cleaner init.
-     */
-    private static Function<Cleaner, CleanerImpl> cleanerImplAccess = null;
-
-    /**
-     * Heads of a CleanableList for each reference type.
-     */
-    final PhantomCleanable<?> phantomCleanableList;
-
-    final WeakCleanable<?> weakCleanableList;
-
-    final SoftCleanable<?> softCleanableList;
-
-    // The ReferenceQueue of pending cleaning actions
-    final ReferenceQueue<Object> queue;
-
-    /**
-     * Called by Cleaner static initialization to provide the function
-     * to map from Cleaner to CleanerImpl.
-     * @param access a function to map from Cleaner to CleanerImpl
-     */
-    public static void setCleanerImplAccess(Function<Cleaner, CleanerImpl> access) {
-        if (cleanerImplAccess == null) {
-            cleanerImplAccess = access;
-        }
-    }
-
-    /**
-     * Called to get the CleanerImpl for a Cleaner.
-     * @param cleaner the cleaner
-     * @return the corresponding CleanerImpl
-     */
-    private static CleanerImpl getCleanerImpl(Cleaner cleaner) {
-        return cleanerImplAccess.apply(cleaner);
-    }
-
-    /**
-     * Constructor for CleanerImpl.
-     */
-    public CleanerImpl() {
-        queue = new ReferenceQueue<>();
-        phantomCleanableList = new PhantomCleanableRef(this);
-        weakCleanableList = new WeakCleanableRef(this);
-        softCleanableList = new SoftCleanableRef(this);
-    }
-
-    /**
-     * Starts the Cleaner implementation.
-     * When started waits for Cleanables to be queued.
-     * @param service the cleaner
-     * @param threadFactory the thread factory
-     */
-    public void start(Cleaner service, ThreadFactory threadFactory) {
-        // schedule a nop cleaning action for the service, so the associated thread
-        // will continue to run at least until the service is reclaimable.
-        new PhantomCleanableRef(service, service, () -> {});
-
-        if (threadFactory == null) {
-            threadFactory = CleanerImpl.InnocuousThreadFactory.factory();
-        }
-
-        // now that there's at least one cleaning action, for the service,
-        // we can start the associated thread, which runs until
-        // all cleaning actions have been run.
-        Thread thread = threadFactory.newThread(this);
-        thread.setDaemon(true);
-        thread.start();
-    }
-
-    /**
-     * Process queued Cleanables as long as the cleanable lists are not empty.
-     * A Cleanable is in one of the lists for each Object and for the Cleaner
-     * itself.
-     * Terminates when the Cleaner is no longer reachable and
-     * has been cleaned and there are no more Cleanable instances
-     * for which the object is reachable.
-     * <p>
-     * If the thread is a ManagedLocalsThread, the threadlocals
-     * are erased before each cleanup
-     */
-    public void run() {
-        Thread t = Thread.currentThread();
-        InnocuousThread mlThread = (t instanceof InnocuousThread)
-                ? (InnocuousThread) t
-                : null;
-        while (!phantomCleanableList.isListEmpty() ||
-                !weakCleanableList.isListEmpty() ||
-                !softCleanableList.isListEmpty()) {
-            if (mlThread != null) {
-                // Clear the thread locals
-                mlThread.eraseThreadLocals();
-            }
-            try {
-                // Wait for a Ref, with a timeout to avoid getting hung
-                // due to a race with clear/clean
-                Cleanable ref = (Cleanable) queue.remove(60 * 1000L);
-                if (ref != null) {
-                    ref.clean();
-                }
-            } catch (InterruptedException i) {
-                continue;   // ignore the interruption
-            } catch (Throwable e) {
-                // ignore exceptions from the cleanup action
-            }
-        }
-    }
-
-    /**
-     * PhantomCleanable subclasses efficiently encapsulate cleanup state and
-     * the cleaning action.
-     * Subclasses implement the abstract {@link #performCleanup()}  method
-     * to provide the cleaning action.
-     * When constructed, the object reference and the {@link Cleanable Cleanable}
-     * are registered with the {@link Cleaner}.
-     * The Cleaner invokes {@link Cleaner.Cleanable#clean() clean} after the
-     * referent becomes phantom reachable.
-     */
-    public static abstract class PhantomCleanable<T> extends PhantomReference<T>
-            implements Cleaner.Cleanable {
-
-        /**
-         * Links to previous and next in a doubly-linked list.
-         */
-        PhantomCleanable<?> prev = this, next = this;
-
-        /**
-         * The CleanerImpl for this Cleanable.
-         */
-        private final CleanerImpl cleanerImpl;
-
-        /**
-         * Constructs new {@code PhantomCleanable} with
-         * {@code non-null referent} and {@code non-null cleaner}.
-         * The {@code cleaner} is not retained; it is only used to
-         * register the newly constructed {@link Cleaner.Cleanable Cleanable}.
-         *
-         * @param referent the referent to track
-         * @param cleaner  the {@code Cleaner} to register with
-         */
-        public PhantomCleanable(T referent, Cleaner cleaner) {
-            super(Objects.requireNonNull(referent), getCleanerImpl(cleaner).queue);
-            this.cleanerImpl = getCleanerImpl(cleaner);
-            insert();
-
-            // TODO: Replace getClass() with ReachabilityFence when it is available
-            cleaner.getClass();
-            referent.getClass();
-        }
-
-        /**
-         * Construct a new root of the list; not inserted.
-         */
-        PhantomCleanable(CleanerImpl cleanerImpl) {
-            super(null, null);
-            this.cleanerImpl = cleanerImpl;
-        }
-
-        /**
-         * Insert this PhantomCleanable after the list head.
-         */
-        private void insert() {
-            final PhantomCleanable<?> list = cleanerImpl.phantomCleanableList;
-            synchronized (list) {
-                prev = list;
-                next = list.next;
-                next.prev = this;
-                list.next = this;
-            }
-        }
-
-        /**
-         * Remove this PhantomCleanable from the list.
-         *
-         * @return true if Cleanable was removed or false if not because
-         * it had already been removed before
-         */
-        private boolean remove() {
-            PhantomCleanable<?> list = cleanerImpl.phantomCleanableList;
-            synchronized (list) {
-                if (next != this) {
-                    next.prev = prev;
-                    prev.next = next;
-                    prev = this;
-                    next = this;
-                    return true;
-                }
-                return false;
-            }
-        }
-
-        /**
-         * Returns true if the list's next reference refers to itself.
-         *
-         * @return true if the list is empty
-         */
-        boolean isListEmpty() {
-            PhantomCleanable<?> list = cleanerImpl.phantomCleanableList;
-            synchronized (list) {
-                return list == list.next;
-            }
-        }
-
-        /**
-         * Unregister this PhantomCleanable and invoke {@link #performCleanup()},
-         * ensuring at-most-once semantics.
-         */
-        @Override
-        public final void clean() {
-            if (remove()) {
-                super.clear();
-                performCleanup();
-            }
-        }
-
-        /**
-         * Unregister this PhantomCleanable and clear the reference.
-         * Due to inherent concurrency, {@link #performCleanup()} may still be invoked.
-         */
-        @Override
-        public void clear() {
-            if (remove()) {
-                super.clear();
-            }
-        }
-
-        /**
-         * The {@code performCleanup} abstract method is overridden
-         * to implement the cleaning logic.
-         * The {@code performCleanup} method should not be called except
-         * by the {@link #clean} method which ensures at most once semantics.
-         */
-        protected abstract void performCleanup();
-
-        /**
-         * This method always throws {@link UnsupportedOperationException}.
-         * Enqueuing details of {@link Cleaner.Cleanable}
-         * are a private implementation detail.
-         *
-         * @throws UnsupportedOperationException always
-         */
-        @Override
-        public final boolean isEnqueued() {
-            throw new UnsupportedOperationException("isEnqueued");
-        }
-
-        /**
-         * This method always throws {@link UnsupportedOperationException}.
-         * Enqueuing details of {@link Cleaner.Cleanable}
-         * are a private implementation detail.
-         *
-         * @throws UnsupportedOperationException always
-         */
-        @Override
-        public final boolean enqueue() {
-            throw new UnsupportedOperationException("enqueue");
-        }
-    }
-
-    /**
-     * WeakCleanable subclasses efficiently encapsulate cleanup state and
-     * the cleaning action.
-     * Subclasses implement the abstract {@link #performCleanup()}  method
-     * to provide the cleaning action.
-     * When constructed, the object reference and the {@link Cleanable Cleanable}
-     * are registered with the {@link Cleaner}.
-     * The Cleaner invokes {@link Cleaner.Cleanable#clean() clean} after the
-     * referent becomes weakly reachable.
-     */
-    public static abstract class WeakCleanable<T> extends WeakReference<T>
-            implements Cleaner.Cleanable {
-
-        /**
-         * Links to previous and next in a doubly-linked list.
-         */
-        WeakCleanable<?> prev = this, next = this;
-
-        /**
-         * The CleanerImpl for this Cleanable.
-         */
-        private final CleanerImpl cleanerImpl;
-
-        /**
-         * Constructs new {@code WeakCleanableReference} with
-         * {@code non-null referent} and {@code non-null cleaner}.
-         * The {@code cleaner} is not retained by this reference; it is only used
-         * to register the newly constructed {@link Cleaner.Cleanable Cleanable}.
-         *
-         * @param referent the referent to track
-         * @param cleaner  the {@code Cleaner} to register new reference with
-         */
-        public WeakCleanable(T referent, Cleaner cleaner) {
-            super(Objects.requireNonNull(referent), getCleanerImpl(cleaner).queue);
-            cleanerImpl = getCleanerImpl(cleaner);
-            insert();
-
-            // TODO: Replace getClass() with ReachabilityFence when it is available
-            cleaner.getClass();
-            referent.getClass();
-        }
-
-        /**
-         * Construct a new root of the list; not inserted.
-         */
-        WeakCleanable(CleanerImpl cleanerImpl) {
-            super(null, null);
-            this.cleanerImpl = cleanerImpl;
-        }
-
-        /**
-         * Insert this WeakCleanableReference after the list head.
-         */
-        private void insert() {
-            final WeakCleanable<?> list = cleanerImpl.weakCleanableList;
-            synchronized (list) {
-                prev = list;
-                next = list.next;
-                next.prev = this;
-                list.next = this;
-            }
-        }
-
-        /**
-         * Remove this WeakCleanableReference from the list.
-         *
-         * @return true if Cleanable was removed or false if not because
-         * it had already been removed before
-         */
-        private boolean remove() {
-            WeakCleanable<?> list = cleanerImpl.weakCleanableList;
-            synchronized (list) {
-                if (next != this) {
-                    next.prev = prev;
-                    prev.next = next;
-                    prev = this;
-                    next = this;
-                    return true;
-                }
-                return false;
-            }
-        }
-
-        /**
-         * Returns true if the list's next reference refers to itself.
-         *
-         * @return true if the list is empty
-         */
-        boolean isListEmpty() {
-            WeakCleanable<?> list = cleanerImpl.weakCleanableList;
-            synchronized (list) {
-                return list == list.next;
-            }
-        }
-
-        /**
-         * Unregister this WeakCleanable reference and invoke {@link #performCleanup()},
-         * ensuring at-most-once semantics.
-         */
-        @Override
-        public final void clean() {
-            if (remove()) {
-                super.clear();
-                performCleanup();
-            }
-        }
-
-        /**
-         * Unregister this WeakCleanable and clear the reference.
-         * Due to inherent concurrency, {@link #performCleanup()} may still be invoked.
-         */
-        @Override
-        public void clear() {
-            if (remove()) {
-                super.clear();
-            }
-        }
-
-        /**
-         * The {@code performCleanup} abstract method is overridden
-         * to implement the cleaning logic.
-         * The {@code performCleanup} method should not be called except
-         * by the {@link #clean} method which ensures at most once semantics.
-         */
-        protected abstract void performCleanup();
-
-        /**
-         * This method always throws {@link UnsupportedOperationException}.
-         * Enqueuing details of {@link java.lang.ref.Cleaner.Cleanable}
-         * are a private implementation detail.
-         *
-         * @throws UnsupportedOperationException always
-         */
-        @Override
-        public final boolean isEnqueued() {
-            throw new UnsupportedOperationException("isEnqueued");
-        }
-
-        /**
-         * This method always throws {@link UnsupportedOperationException}.
-         * Enqueuing details of {@link java.lang.ref.Cleaner.Cleanable}
-         * are a private implementation detail.
-         *
-         * @throws UnsupportedOperationException always
-         */
-        @Override
-        public final boolean enqueue() {
-            throw new UnsupportedOperationException("enqueue");
-        }
-    }
-
-    /**
-     * SoftCleanable subclasses efficiently encapsulate cleanup state and
-     * the cleaning action.
-     * Subclasses implement the abstract {@link #performCleanup()}  method
-     * to provide the cleaning action.
-     * When constructed, the object reference and the {@link Cleanable Cleanable}
-     * are registered with the {@link Cleaner}.
-     * The Cleaner invokes {@link Cleaner.Cleanable#clean() clean} after the
-     * referent becomes softly reachable.
-     */
-    public static abstract class SoftCleanable<T> extends SoftReference<T>
-            implements Cleaner.Cleanable {
-
-        /**
-         * Links to previous and next in a doubly-linked list.
-         */
-        SoftCleanable<?> prev = this, next = this;
-
-        /**
-         * The CleanerImpl for this Cleanable.
-         */
-        private final CleanerImpl cleanerImpl;
-
-        /**
-         * Constructs new {@code SoftCleanableReference} with
-         * {@code non-null referent} and {@code non-null cleaner}.
-         * The {@code cleaner} is not retained by this reference; it is only used
-         * to register the newly constructed {@link Cleaner.Cleanable Cleanable}.
-         *
-         * @param referent the referent to track
-         * @param cleaner  the {@code Cleaner} to register with
-         */
-        public SoftCleanable(T referent, Cleaner cleaner) {
-            super(Objects.requireNonNull(referent), getCleanerImpl(cleaner).queue);
-            cleanerImpl = getCleanerImpl(cleaner);
-            insert();
-
-            // TODO: Replace getClass() with ReachabilityFence when it is available
-            cleaner.getClass();
-            referent.getClass();
-        }
-
-        /**
-         * Construct a new root of the list; not inserted.
-         */
-        SoftCleanable(CleanerImpl cleanerImpl) {
-            super(null, null);
-            this.cleanerImpl = cleanerImpl;
-        }
-
-        /**
-         * Insert this SoftCleanableReference after the list head.
-         */
-        private void insert() {
-            final SoftCleanable<?> list = cleanerImpl.softCleanableList;
-            synchronized (list) {
-                prev = list;
-                next = list.next;
-                next.prev = this;
-                list.next = this;
-            }
-        }
-
-        /**
-         * Remove this SoftCleanableReference from the list.
-         *
-         * @return true if Cleanable was removed or false if not because
-         * it had already been removed before
-         */
-        private boolean remove() {
-            SoftCleanable<?> list = cleanerImpl.softCleanableList;
-            synchronized (list) {
-                if (next != this) {
-                    next.prev = prev;
-                    prev.next = next;
-                    prev = this;
-                    next = this;
-                    return true;
-                }
-                return false;
-            }
-        }
-
-        /**
-         * Returns true if the list's next reference refers to itself.
-         *
-         * @return true if the list is empty
-         */
-        boolean isListEmpty() {
-            SoftCleanable<?> list = cleanerImpl.softCleanableList;
-            synchronized (list) {
-                return list == list.next;
-            }
-        }
-
-        /**
-         * Unregister this SoftCleanable reference and invoke {@link #performCleanup()},
-         * ensuring at-most-once semantics.
-         */
-        @Override
-        public final void clean() {
-            if (remove()) {
-                super.clear();
-                performCleanup();
-            }
-        }
-
-        /**
-         * Unregister this SoftCleanable and clear the reference.
-         * Due to inherent concurrency, {@link #performCleanup()} may still be invoked.
-         */
-        @Override
-        public void clear() {
-            if (remove()) {
-                super.clear();
-            }
-        }
-
-        /**
-         * The {@code performCleanup} abstract method is overridden
-         * to implement the cleaning logic.
-         * The {@code performCleanup} method should not be called except
-         * by the {@link #clean} method which ensures at most once semantics.
-         */
-        protected abstract void performCleanup();
-
-        /**
-         * This method always throws {@link UnsupportedOperationException}.
-         * Enqueuing details of {@link Cleaner.Cleanable}
-         * are a private implementation detail.
-         *
-         * @throws UnsupportedOperationException always
-         */
-        @Override
-        public final boolean isEnqueued() {
-            throw new UnsupportedOperationException("isEnqueued");
-        }
-
-        /**
-         * This method always throws {@link UnsupportedOperationException}.
-         * Enqueuing details of {@link Cleaner.Cleanable}
-         * are a private implementation detail.
-         *
-         * @throws UnsupportedOperationException always
-         */
-        @Override
-        public final boolean enqueue() {
-            throw new UnsupportedOperationException("enqueue");
-        }
-    }
-
-    /**
-     * Perform cleaning on an unreachable PhantomReference.
-     */
-    public static final class PhantomCleanableRef extends PhantomCleanable<Object> {
-        private final Runnable action;
-
-        /**
-         * Constructor for a phantom cleanable reference.
-         * @param obj the object to monitor
-         * @param cleaner the cleaner
-         * @param action the action Runnable
-         */
-        public PhantomCleanableRef(Object obj, Cleaner cleaner, Runnable action) {
-            super(obj, cleaner);
-            this.action = action;
-        }
-
-        /**
-         * Constructor used only for root of phantom cleanable list.
-         * @param cleanerImpl  the cleanerImpl
-         */
-        PhantomCleanableRef(CleanerImpl cleanerImpl) {
-            super(cleanerImpl);
-            this.action = null;
-        }
-
-        @Override
-        protected void performCleanup() {
-            action.run();
-        }
-
-        /**
-         * Prevent access to referent even when it is still alive.
-         *
-         * @throws UnsupportedOperationException always
-         */
-        @Override
-        public Object get() {
-            throw new UnsupportedOperationException("get");
-        }
-
-        /**
-         * Direct clearing of the referent is not supported.
-         *
-         * @throws UnsupportedOperationException always
-         */
-        @Override
-        public void clear() {
-            throw new UnsupportedOperationException("clear");
-        }
-    }
-
-    /**
-     * Perform cleaning on an unreachable WeakReference.
-     */
-    public static final class WeakCleanableRef extends WeakCleanable<Object> {
-        private final Runnable action;
-
-        /**
-         * Constructor for a weak cleanable reference.
-         * @param obj the object to monitor
-         * @param cleaner the cleaner
-         * @param action the action Runnable
-         */
-        WeakCleanableRef(Object obj, Cleaner cleaner, Runnable action) {
-            super(obj, cleaner);
-            this.action = action;
-        }
-
-        /**
-         * Constructor used only for root of weak cleanable list.
-         * @param cleanerImpl  the cleanerImpl
-         */
-        WeakCleanableRef(CleanerImpl cleanerImpl) {
-            super(cleanerImpl);
-            this.action = null;
-        }
-
-        @Override
-        protected void performCleanup() {
-            action.run();
-        }
-
-        /**
-         * Prevent access to referent even when it is still alive.
-         *
-         * @throws UnsupportedOperationException always
-         */
-        @Override
-        public Object get() {
-            throw new UnsupportedOperationException("get");
-        }
-
-        /**
-         * Direct clearing of the referent is not supported.
-         *
-         * @throws UnsupportedOperationException always
-         */
-        @Override
-        public void clear() {
-            throw new UnsupportedOperationException("clear");
-        }
-    }
-
-    /**
-     * Perform cleaning on an unreachable SoftReference.
-     */
-    public static final class SoftCleanableRef extends SoftCleanable<Object> {
-        private final Runnable action;
-
-        /**
-         * Constructor for a soft cleanable reference.
-         * @param obj the object to monitor
-         * @param cleaner the cleaner
-         * @param action the action Runnable
-         */
-        SoftCleanableRef(Object obj, Cleaner cleaner, Runnable action) {
-            super(obj, cleaner);
-            this.action = action;
-        }
-
-        /**
-         * Constructor used only for root of soft cleanable list.
-         * @param cleanerImpl  the cleanerImpl
-         */
-        SoftCleanableRef(CleanerImpl cleanerImpl) {
-            super(cleanerImpl);
-            this.action = null;
-        }
-
-        @Override
-        protected void performCleanup() {
-            action.run();
-        }
-
-        /**
-         * Prevent access to referent even when it is still alive.
-         *
-         * @throws UnsupportedOperationException always
-         */
-        @Override
-        public Object get() {
-            throw new UnsupportedOperationException("get");
-        }
-
-        /**
-         * Direct clearing of the referent is not supported.
-         *
-         * @throws UnsupportedOperationException always
-         */
-        @Override
-        public void clear() {
-            throw new UnsupportedOperationException("clear");
-        }
-
-    }
-
-    /**
-     * A ThreadFactory for InnocuousThreads.
-     * The factory is a singleton.
-     */
-    static final class InnocuousThreadFactory implements ThreadFactory {
-        final static ThreadFactory factory = new InnocuousThreadFactory();
-
-        static ThreadFactory factory() {
-            return factory;
-        }
-
-        public Thread newThread(Runnable r) {
-            return AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
-                Thread t = new InnocuousThread(r);
-                t.setPriority(Thread.MAX_PRIORITY - 2);
-                t.setName("Cleaner-" + t.getId());
-                return t;
-            });
-        }
-    }
-
-}
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Fri Jan 15 19:18:42 2016 +0000
@@ -30,7 +30,7 @@
 
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 import jdk.internal.HotSpotIntrinsicCandidate;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/VM.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,433 @@
+/*
+ * Copyright (c) 1996, 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 jdk.internal.misc;
+
+import static java.lang.Thread.State.*;
+import java.util.Properties;
+
+public class VM {
+
+    /* The following methods used to be native methods that instruct
+     * the VM to selectively suspend certain threads in low-memory
+     * situations. They are inherently dangerous and not implementable
+     * on native threads. We removed them in JDK 1.2. The skeletons
+     * remain so that existing applications that use these methods
+     * will still work.
+     */
+    private static boolean suspended = false;
+
+    /** @deprecated */
+    @Deprecated
+    public static boolean threadsSuspended() {
+        return suspended;
+    }
+
+    @SuppressWarnings("deprecation")
+    public static boolean allowThreadSuspension(ThreadGroup g, boolean b) {
+        return g.allowThreadSuspension(b);
+    }
+
+    /** @deprecated */
+    @Deprecated
+    public static boolean suspendThreads() {
+        suspended = true;
+        return true;
+    }
+
+    // Causes any suspended threadgroups to be resumed.
+    /** @deprecated */
+    @Deprecated
+    public static void unsuspendThreads() {
+        suspended = false;
+    }
+
+    // Causes threadgroups no longer marked suspendable to be resumed.
+    /** @deprecated */
+    @Deprecated
+    public static void unsuspendSomeThreads() {
+    }
+
+    /* Deprecated fields and methods -- Memory advice not supported in 1.2 */
+
+    /** @deprecated */
+    @Deprecated
+    public static final int STATE_GREEN = 1;
+
+    /** @deprecated */
+    @Deprecated
+    public static final int STATE_YELLOW = 2;
+
+    /** @deprecated */
+    @Deprecated
+    public static final int STATE_RED = 3;
+
+    /** @deprecated */
+    @Deprecated
+    public static final int getState() {
+        return STATE_GREEN;
+    }
+
+    /** @deprecated */
+    @Deprecated
+    public static void registerVMNotification(VMNotification n) { }
+
+    /** @deprecated */
+    @Deprecated
+    public static void asChange(int as_old, int as_new) { }
+
+    /** @deprecated */
+    @Deprecated
+    public static void asChange_otherthread(int as_old, int as_new) { }
+
+    /*
+     * Not supported in 1.2 because these will have to be exported as
+     * JVM functions, and we are not sure we want do that. Leaving
+     * here so it can be easily resurrected -- just remove the //
+     * comments.
+     */
+
+    /**
+     * Resume Java profiling.  All profiling data is added to any
+     * earlier profiling, unless <code>resetJavaProfiler</code> is
+     * called in between.  If profiling was not started from the
+     * command line, <code>resumeJavaProfiler</code> will start it.
+     * <p>
+     *
+     * NOTE: Profiling must be enabled from the command line for a
+     * java.prof report to be automatically generated on exit; if not,
+     * writeJavaProfilerReport must be invoked to write a report.
+     *
+     * @see     resetJavaProfiler
+     * @see     writeJavaProfilerReport
+     */
+
+    // public native static void resumeJavaProfiler();
+
+    /**
+     * Suspend Java profiling.
+     */
+    // public native static void suspendJavaProfiler();
+
+    /**
+     * Initialize Java profiling.  Any accumulated profiling
+     * information is discarded.
+     */
+    // public native static void resetJavaProfiler();
+
+    /**
+     * Write the current profiling contents to the file "java.prof".
+     * If the file already exists, it will be overwritten.
+     */
+    // public native static void writeJavaProfilerReport();
+
+
+    private static volatile boolean booted = false;
+    private static final Object lock = new Object();
+
+    // Invoked by System.initializeSystemClass just before returning.
+    // Subsystems that are invoked during initialization can check this
+    // property in order to avoid doing things that should wait until the
+    // application class loader has been set up.
+    //
+    public static void booted() {
+        synchronized (lock) {
+            booted = true;
+            lock.notifyAll();
+        }
+    }
+
+    public static boolean isBooted() {
+        return booted;
+    }
+
+    // Waits until VM completes initialization
+    //
+    // This method is invoked by the Finalizer thread
+    public static void awaitBooted() throws InterruptedException {
+        synchronized (lock) {
+            while (!booted) {
+                lock.wait();
+            }
+        }
+    }
+
+    // A user-settable upper limit on the maximum amount of allocatable direct
+    // buffer memory.  This value may be changed during VM initialization if
+    // "java" is launched with "-XX:MaxDirectMemorySize=<size>".
+    //
+    // The initial value of this field is arbitrary; during JRE initialization
+    // it will be reset to the value specified on the command line, if any,
+    // otherwise to Runtime.getRuntime().maxMemory().
+    //
+    private static long directMemory = 64 * 1024 * 1024;
+
+    // Returns the maximum amount of allocatable direct buffer memory.
+    // The directMemory variable is initialized during system initialization
+    // in the saveAndRemoveProperties method.
+    //
+    public static long maxDirectMemory() {
+        return directMemory;
+    }
+
+    // User-controllable flag that determines if direct buffers should be page
+    // aligned. The "-XX:+PageAlignDirectMemory" option can be used to force
+    // buffers, allocated by ByteBuffer.allocateDirect, to be page aligned.
+    private static boolean pageAlignDirectMemory;
+
+    // Returns {@code true} if the direct buffers should be page aligned. This
+    // variable is initialized by saveAndRemoveProperties.
+    public static boolean isDirectMemoryPageAligned() {
+        return pageAlignDirectMemory;
+    }
+
+    /**
+     * Returns true if the given class loader is in the system domain
+     * in which all permissions are granted.
+     */
+    public static boolean isSystemDomainLoader(ClassLoader loader) {
+        return loader == null;
+    }
+
+    /**
+     * Returns the system property of the specified key saved at
+     * system initialization time.  This method should only be used
+     * for the system properties that are not changed during runtime.
+     * It accesses a private copy of the system properties so
+     * that user's locking of the system properties object will not
+     * cause the library to deadlock.
+     *
+     * Note that the saved system properties do not include
+     * the ones set by sun.misc.Version.init().
+     *
+     */
+    public static String getSavedProperty(String key) {
+        if (savedProps.isEmpty())
+            throw new IllegalStateException("Should be non-empty if initialized");
+
+        return savedProps.getProperty(key);
+    }
+
+    // TODO: the Property Management needs to be refactored and
+    // the appropriate prop keys need to be accessible to the
+    // calling classes to avoid duplication of keys.
+    private static final Properties savedProps = new Properties();
+
+    // Save a private copy of the system properties and remove
+    // the system properties that are not intended for public access.
+    //
+    // This method can only be invoked during system initialization.
+    public static void saveAndRemoveProperties(Properties props) {
+        if (booted)
+            throw new IllegalStateException("System initialization has completed");
+
+        savedProps.putAll(props);
+
+        // Set the maximum amount of direct memory.  This value is controlled
+        // by the vm option -XX:MaxDirectMemorySize=<size>.
+        // The maximum amount of allocatable direct buffer memory (in bytes)
+        // from the system property sun.nio.MaxDirectMemorySize set by the VM.
+        // The system property will be removed.
+        String s = (String)props.remove("sun.nio.MaxDirectMemorySize");
+        if (s != null) {
+            if (s.equals("-1")) {
+                // -XX:MaxDirectMemorySize not given, take default
+                directMemory = Runtime.getRuntime().maxMemory();
+            } else {
+                long l = Long.parseLong(s);
+                if (l > -1)
+                    directMemory = l;
+            }
+        }
+
+        // Check if direct buffers should be page aligned
+        s = (String)props.remove("sun.nio.PageAlignDirectMemory");
+        if ("true".equals(s))
+            pageAlignDirectMemory = true;
+
+        // Remove other private system properties
+        // used by java.lang.Integer.IntegerCache
+        props.remove("java.lang.Integer.IntegerCache.high");
+
+        // used by sun.launcher.LauncherHelper
+        props.remove("sun.java.launcher.diag");
+    }
+
+    // Initialize any miscellenous operating system settings that need to be
+    // set for the class libraries.
+    //
+    public static void initializeOSEnvironment() {
+        if (!booted) {
+            OSEnvironment.initialize();
+        }
+    }
+
+    /* Current count of objects pending for finalization */
+    private static volatile int finalRefCount;
+
+    /* Peak count of objects pending for finalization */
+    private static volatile int peakFinalRefCount;
+
+    /*
+     * Gets the number of objects pending for finalization.
+     *
+     * @return the number of objects pending for finalization.
+     */
+    public static int getFinalRefCount() {
+        return finalRefCount;
+    }
+
+    /*
+     * Gets the peak number of objects pending for finalization.
+     *
+     * @return the peak number of objects pending for finalization.
+     */
+    public static int getPeakFinalRefCount() {
+        return peakFinalRefCount;
+    }
+
+    /*
+     * Add {@code n} to the objects pending for finalization count.
+     *
+     * @param n an integer value to be added to the objects pending
+     * for finalization count
+     */
+    public static void addFinalRefCount(int n) {
+        // The caller must hold lock to synchronize the update.
+
+        finalRefCount += n;
+        if (finalRefCount > peakFinalRefCount) {
+            peakFinalRefCount = finalRefCount;
+        }
+    }
+
+    /**
+     * Returns Thread.State for the given threadStatus
+     */
+    public static Thread.State toThreadState(int threadStatus) {
+        if ((threadStatus & JVMTI_THREAD_STATE_RUNNABLE) != 0) {
+            return RUNNABLE;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER) != 0) {
+            return BLOCKED;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_INDEFINITELY) != 0) {
+            return WAITING;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) != 0) {
+            return TIMED_WAITING;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_TERMINATED) != 0) {
+            return TERMINATED;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_ALIVE) == 0) {
+            return NEW;
+        } else {
+            return RUNNABLE;
+        }
+    }
+
+    /* The threadStatus field is set by the VM at state transition
+     * in the hotspot implementation. Its value is set according to
+     * the JVM TI specification GetThreadState function.
+     */
+    private static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
+    private static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002;
+    private static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004;
+    private static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400;
+    private static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010;
+    private static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
+
+    /*
+     * Returns the first non-null class loader up the execution stack,
+     * or null if only code from the null class loader is on the stack.
+     */
+    public static native ClassLoader latestUserDefinedLoader();
+
+    /**
+     * Returns {@code true} if we are in a set UID program.
+     */
+    public static boolean isSetUID() {
+        long uid = getuid();
+        long euid = geteuid();
+        long gid = getgid();
+        long egid = getegid();
+        return uid != euid  || gid != egid;
+    }
+
+    /**
+     * Returns the real user ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long getuid();
+
+    /**
+     * Returns the effective user ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long geteuid();
+
+    /**
+     * Returns the real group ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long getgid();
+
+    /**
+     * Returns the effective group ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long getegid();
+
+    /**
+     * Get a nanosecond time stamp adjustment in the form of a single long.
+     *
+     * This value can be used to create an instant using
+     * {@link java.time.Instant#ofEpochSecond(long, long)
+     *  java.time.Instant.ofEpochSecond(offsetInSeconds,
+     *  getNanoTimeAdjustment(offsetInSeconds))}.
+     * <p>
+     * The value returned has the best resolution available to the JVM on
+     * the current system.
+     * This is usually down to microseconds - or tenth of microseconds -
+     * depending on the OS/Hardware and the JVM implementation.
+     *
+     * @param offsetInSeconds The offset in seconds from which the nanosecond
+     *        time stamp should be computed.
+     *
+     * @apiNote The offset should be recent enough - so that
+     *         {@code offsetInSeconds} is within {@code +/- 2^32} seconds of the
+     *         current UTC time. If the offset is too far off, {@code -1} will be
+     *         returned. As such, {@code -1} must not be considered as a valid
+     *         nano time adjustment, but as an exception value indicating
+     *         that an offset closer to the current time should be used.
+     *
+     * @return A nanosecond time stamp adjustment in the form of a single long.
+     *     If the offset is too far off the current time, this method returns -1.
+     *     In that case, the caller should call this method again, passing a
+     *     more accurate offset.
+     */
+    public static native long getNanoTimeAdjustment(long offsetInSeconds);
+
+    static {
+        initialize();
+    }
+    private static native void initialize();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/VMNotification.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1996, 2004, 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.misc;
+
+/** @deprecated */
+@Deprecated
+public interface VMNotification {
+
+    // when the vm switches allocation states, we get notified
+    // (possible semantics: if the state changes while in this
+    // notification, don't recursively notify).
+    // oldState and newState may be the same if we are just releasing
+    // suspended threads.
+    void newAllocState(int oldState, int newState,
+                       boolean threadsSuspended);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/CleanerFactory.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 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.
+ */
+
+package jdk.internal.ref;
+
+import java.lang.ref.Cleaner;
+
+/**
+ * CleanerFactory provides a Cleaner for use within OpenJDK modules.
+ * The cleaner is created on the first reference to the CleanerFactory.
+ */
+public final class CleanerFactory {
+
+    /* The common Cleaner. */
+    private final static Cleaner commonCleaner = Cleaner.create();
+
+    /**
+     * Cleaner for use within OpenJDK modules.
+     *
+     * @return a Cleaner for use within OpenJDK modules
+     */
+    public static Cleaner cleaner() {
+        return commonCleaner;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,333 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.internal.ref;
+
+import java.lang.ref.Cleaner;
+import java.lang.ref.Cleaner.Cleanable;
+import java.lang.ref.ReferenceQueue;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.concurrent.ThreadFactory;
+import java.util.function.Function;
+
+import sun.misc.InnocuousThread;
+
+/**
+ * CleanerImpl manages a set of object references and corresponding cleaning actions.
+ * CleanerImpl provides the functionality of {@link java.lang.ref.Cleaner}.
+ */
+public final class CleanerImpl {
+
+    /**
+     * An object to access the CleanerImpl from a Cleaner; set by Cleaner init.
+     */
+    private static Function<Cleaner, CleanerImpl> cleanerImplAccess = null;
+
+    /**
+     * Heads of a CleanableList for each reference type.
+     */
+    final PhantomCleanable<?> phantomCleanableList;
+
+    final WeakCleanable<?> weakCleanableList;
+
+    final SoftCleanable<?> softCleanableList;
+
+    // The ReferenceQueue of pending cleaning actions
+    final ReferenceQueue<Object> queue;
+
+    /**
+     * Called by Cleaner static initialization to provide the function
+     * to map from Cleaner to CleanerImpl.
+     * @param access a function to map from Cleaner to CleanerImpl
+     */
+    public static void setCleanerImplAccess(Function<Cleaner, CleanerImpl> access) {
+        if (cleanerImplAccess == null) {
+            cleanerImplAccess = access;
+        } else {
+            throw new InternalError("cleanerImplAccess");
+        }
+    }
+
+    /**
+     * Called to get the CleanerImpl for a Cleaner.
+     * @param cleaner the cleaner
+     * @return the corresponding CleanerImpl
+     */
+    static CleanerImpl getCleanerImpl(Cleaner cleaner) {
+        return cleanerImplAccess.apply(cleaner);
+    }
+
+    /**
+     * Constructor for CleanerImpl.
+     */
+    public CleanerImpl() {
+        queue = new ReferenceQueue<>();
+        phantomCleanableList = new PhantomCleanableRef();
+        weakCleanableList = new WeakCleanableRef();
+        softCleanableList = new SoftCleanableRef();
+    }
+
+    /**
+     * Starts the Cleaner implementation.
+     * Ensure this is the CleanerImpl for the Cleaner.
+     * When started waits for Cleanables to be queued.
+     * @param cleaner the cleaner
+     * @param threadFactory the thread factory
+     */
+    public void start(Cleaner cleaner, ThreadFactory threadFactory) {
+        if (getCleanerImpl(cleaner) != this) {
+            throw new AssertionError("wrong cleaner");
+        }
+        // schedule a nop cleaning action for the cleaner, so the associated thread
+        // will continue to run at least until the cleaner is reclaimable.
+        new PhantomCleanableRef(cleaner, cleaner, () -> {});
+
+        if (threadFactory == null) {
+            threadFactory = CleanerImpl.InnocuousThreadFactory.factory();
+        }
+
+        // now that there's at least one cleaning action, for the cleaner,
+        // we can start the associated thread, which runs until
+        // all cleaning actions have been run.
+        Thread thread = threadFactory.newThread(this::run);
+        thread.setDaemon(true);
+        thread.start();
+    }
+
+    /**
+     * Process queued Cleanables as long as the cleanable lists are not empty.
+     * A Cleanable is in one of the lists for each Object and for the Cleaner
+     * itself.
+     * Terminates when the Cleaner is no longer reachable and
+     * has been cleaned and there are no more Cleanable instances
+     * for which the object is reachable.
+     * <p>
+     * If the thread is a ManagedLocalsThread, the threadlocals
+     * are erased before each cleanup
+     */
+    private void run() {
+        Thread t = Thread.currentThread();
+        InnocuousThread mlThread = (t instanceof InnocuousThread)
+                ? (InnocuousThread) t
+                : null;
+        while (!phantomCleanableList.isListEmpty() ||
+                !weakCleanableList.isListEmpty() ||
+                !softCleanableList.isListEmpty()) {
+            if (mlThread != null) {
+                // Clear the thread locals
+                mlThread.eraseThreadLocals();
+            }
+            try {
+                // Wait for a Ref, with a timeout to avoid getting hung
+                // due to a race with clear/clean
+                Cleanable ref = (Cleanable) queue.remove(60 * 1000L);
+                if (ref != null) {
+                    ref.clean();
+                }
+            } catch (InterruptedException i) {
+                continue;   // ignore the interruption
+            } catch (Throwable e) {
+                // ignore exceptions from the cleanup action
+            }
+        }
+    }
+
+    /**
+     * Perform cleaning on an unreachable PhantomReference.
+     */
+    public static final class PhantomCleanableRef extends PhantomCleanable<Object> {
+        private final Runnable action;
+
+        /**
+         * Constructor for a phantom cleanable reference.
+         * @param obj the object to monitor
+         * @param cleaner the cleaner
+         * @param action the action Runnable
+         */
+        public PhantomCleanableRef(Object obj, Cleaner cleaner, Runnable action) {
+            super(obj, cleaner);
+            this.action = action;
+        }
+
+        /**
+         * Constructor used only for root of phantom cleanable list.
+         */
+        PhantomCleanableRef() {
+            super();
+            this.action = null;
+        }
+
+        @Override
+        protected void performCleanup() {
+            action.run();
+        }
+
+        /**
+         * Prevent access to referent even when it is still alive.
+         *
+         * @throws UnsupportedOperationException always
+         */
+        @Override
+        public Object get() {
+            throw new UnsupportedOperationException("get");
+        }
+
+        /**
+         * Direct clearing of the referent is not supported.
+         *
+         * @throws UnsupportedOperationException always
+         */
+        @Override
+        public void clear() {
+            throw new UnsupportedOperationException("clear");
+        }
+    }
+
+    /**
+     * Perform cleaning on an unreachable WeakReference.
+     */
+    public static final class WeakCleanableRef extends WeakCleanable<Object> {
+        private final Runnable action;
+
+        /**
+         * Constructor for a weak cleanable reference.
+         * @param obj the object to monitor
+         * @param cleaner the cleaner
+         * @param action the action Runnable
+         */
+        WeakCleanableRef(Object obj, Cleaner cleaner, Runnable action) {
+            super(obj, cleaner);
+            this.action = action;
+        }
+
+        /**
+         * Constructor used only for root of weak cleanable list.
+         */
+        WeakCleanableRef() {
+            super();
+            this.action = null;
+        }
+
+        @Override
+        protected void performCleanup() {
+            action.run();
+        }
+
+        /**
+         * Prevent access to referent even when it is still alive.
+         *
+         * @throws UnsupportedOperationException always
+         */
+        @Override
+        public Object get() {
+            throw new UnsupportedOperationException("get");
+        }
+
+        /**
+         * Direct clearing of the referent is not supported.
+         *
+         * @throws UnsupportedOperationException always
+         */
+        @Override
+        public void clear() {
+            throw new UnsupportedOperationException("clear");
+        }
+    }
+
+    /**
+     * Perform cleaning on an unreachable SoftReference.
+     */
+    public static final class SoftCleanableRef extends SoftCleanable<Object> {
+        private final Runnable action;
+
+        /**
+         * Constructor for a soft cleanable reference.
+         * @param obj the object to monitor
+         * @param cleaner the cleaner
+         * @param action the action Runnable
+         */
+        SoftCleanableRef(Object obj, Cleaner cleaner, Runnable action) {
+            super(obj, cleaner);
+            this.action = action;
+        }
+
+        /**
+         * Constructor used only for root of soft cleanable list.
+         */
+        SoftCleanableRef() {
+            super();
+            this.action = null;
+        }
+
+        @Override
+        protected void performCleanup() {
+            action.run();
+        }
+
+        /**
+         * Prevent access to referent even when it is still alive.
+         *
+         * @throws UnsupportedOperationException always
+         */
+        @Override
+        public Object get() {
+            throw new UnsupportedOperationException("get");
+        }
+
+        /**
+         * Direct clearing of the referent is not supported.
+         *
+         * @throws UnsupportedOperationException always
+         */
+        @Override
+        public void clear() {
+            throw new UnsupportedOperationException("clear");
+        }
+
+    }
+
+    /**
+     * A ThreadFactory for InnocuousThreads.
+     * The factory is a singleton.
+     */
+    static final class InnocuousThreadFactory implements ThreadFactory {
+        final static ThreadFactory factory = new InnocuousThreadFactory();
+
+        static ThreadFactory factory() {
+            return factory;
+        }
+
+        public Thread newThread(Runnable r) {
+            return AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
+                Thread t = new InnocuousThread(r);
+                t.setPriority(Thread.MAX_PRIORITY - 2);
+                t.setName("Cleaner-" + t.getId());
+                return t;
+            });
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.internal.ref;
+
+import java.lang.ref.Cleaner;
+import java.lang.ref.PhantomReference;
+import java.util.Objects;
+
+/**
+ * PhantomCleanable subclasses efficiently encapsulate cleanup state and
+ * the cleaning action.
+ * Subclasses implement the abstract {@link #performCleanup()}  method
+ * to provide the cleaning action.
+ * When constructed, the object reference and the {@link Cleaner.Cleanable Cleanable}
+ * are registered with the {@link Cleaner}.
+ * The Cleaner invokes {@link Cleaner.Cleanable#clean() clean} after the
+ * referent becomes phantom reachable.
+ */
+public abstract class PhantomCleanable<T> extends PhantomReference<T>
+        implements Cleaner.Cleanable {
+
+    /**
+     * Links to previous and next in a doubly-linked list.
+     */
+    PhantomCleanable<?> prev = this, next = this;
+
+    /**
+     * The list of PhantomCleanable; synchronizes insert and remove.
+     */
+    private final PhantomCleanable<?> list;
+
+    /**
+     * Constructs new {@code PhantomCleanable} with
+     * {@code non-null referent} and {@code non-null cleaner}.
+     * The {@code cleaner} is not retained; it is only used to
+     * register the newly constructed {@link Cleaner.Cleanable Cleanable}.
+     *
+     * @param referent the referent to track
+     * @param cleaner  the {@code Cleaner} to register with
+     */
+    public PhantomCleanable(T referent, Cleaner cleaner) {
+        super(Objects.requireNonNull(referent), CleanerImpl.getCleanerImpl(cleaner).queue);
+        this.list = CleanerImpl.getCleanerImpl(cleaner).phantomCleanableList;
+        insert();
+
+        // TODO: Replace getClass() with ReachabilityFence when it is available
+        cleaner.getClass();
+        referent.getClass();
+    }
+
+    /**
+     * Construct a new root of the list; not inserted.
+     */
+    PhantomCleanable() {
+        super(null, null);
+        this.list = this;
+    }
+
+    /**
+     * Insert this PhantomCleanable after the list head.
+     */
+    private void insert() {
+        synchronized (list) {
+            prev = list;
+            next = list.next;
+            next.prev = this;
+            list.next = this;
+        }
+    }
+
+    /**
+     * Remove this PhantomCleanable from the list.
+     *
+     * @return true if Cleanable was removed or false if not because
+     * it had already been removed before
+     */
+    private boolean remove() {
+        synchronized (list) {
+            if (next != this) {
+                next.prev = prev;
+                prev.next = next;
+                prev = this;
+                next = this;
+                return true;
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Returns true if the list's next reference refers to itself.
+     *
+     * @return true if the list is empty
+     */
+    boolean isListEmpty() {
+        synchronized (list) {
+            return list == list.next;
+        }
+    }
+
+    /**
+     * Unregister this PhantomCleanable and invoke {@link #performCleanup()},
+     * ensuring at-most-once semantics.
+     */
+    @Override
+    public final void clean() {
+        if (remove()) {
+            super.clear();
+            performCleanup();
+        }
+    }
+
+    /**
+     * Unregister this PhantomCleanable and clear the reference.
+     * Due to inherent concurrency, {@link #performCleanup()} may still be invoked.
+     */
+    @Override
+    public void clear() {
+        if (remove()) {
+            super.clear();
+        }
+    }
+
+    /**
+     * The {@code performCleanup} abstract method is overridden
+     * to implement the cleaning logic.
+     * The {@code performCleanup} method should not be called except
+     * by the {@link #clean} method which ensures at most once semantics.
+     */
+    protected abstract void performCleanup();
+
+    /**
+     * This method always throws {@link UnsupportedOperationException}.
+     * Enqueuing details of {@link Cleaner.Cleanable}
+     * are a private implementation detail.
+     *
+     * @throws UnsupportedOperationException always
+     */
+    @Override
+    public final boolean isEnqueued() {
+        throw new UnsupportedOperationException("isEnqueued");
+    }
+
+    /**
+     * This method always throws {@link UnsupportedOperationException}.
+     * Enqueuing details of {@link Cleaner.Cleanable}
+     * are a private implementation detail.
+     *
+     * @throws UnsupportedOperationException always
+     */
+    @Override
+    public final boolean enqueue() {
+        throw new UnsupportedOperationException("enqueue");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.internal.ref;
+
+import java.lang.ref.Cleaner;
+import java.lang.ref.SoftReference;
+import java.util.Objects;
+
+/**
+ * SoftCleanable subclasses efficiently encapsulate cleanup state and
+ * the cleaning action.
+ * Subclasses implement the abstract {@link #performCleanup()}  method
+ * to provide the cleaning action.
+ * When constructed, the object reference and the {@link Cleaner.Cleanable Cleanable}
+ * are registered with the {@link Cleaner}.
+ * The Cleaner invokes {@link Cleaner.Cleanable#clean() clean} after the
+ * referent becomes softly reachable.
+ */
+public abstract class SoftCleanable<T> extends SoftReference<T>
+        implements Cleaner.Cleanable {
+
+    /**
+     * Links to previous and next in a doubly-linked list.
+     */
+    SoftCleanable<?> prev = this, next = this;
+
+    /**
+     * The list of SoftCleanable; synchronizes insert and remove.
+     */
+    private final SoftCleanable<?> list;
+
+    /**
+     * Constructs new {@code SoftCleanableReference} with
+     * {@code non-null referent} and {@code non-null cleaner}.
+     * The {@code cleaner} is not retained by this reference; it is only used
+     * to register the newly constructed {@link Cleaner.Cleanable Cleanable}.
+     *
+     * @param referent the referent to track
+     * @param cleaner  the {@code Cleaner} to register with
+     */
+    public SoftCleanable(T referent, Cleaner cleaner) {
+        super(Objects.requireNonNull(referent), CleanerImpl.getCleanerImpl(cleaner).queue);
+        list = CleanerImpl.getCleanerImpl(cleaner).softCleanableList;
+        insert();
+
+        // TODO: Replace getClass() with ReachabilityFence when it is available
+        cleaner.getClass();
+        referent.getClass();
+    }
+
+    /**
+     * Construct a new root of the list; not inserted.
+     */
+    SoftCleanable() {
+        super(null, null);
+        this.list = this;
+    }
+
+    /**
+     * Insert this SoftCleanableReference after the list head.
+     */
+    private void insert() {
+        synchronized (list) {
+            prev = list;
+            next = list.next;
+            next.prev = this;
+            list.next = this;
+        }
+    }
+
+    /**
+     * Remove this SoftCleanableReference from the list.
+     *
+     * @return true if Cleanable was removed or false if not because
+     * it had already been removed before
+     */
+    private boolean remove() {
+        synchronized (list) {
+            if (next != this) {
+                next.prev = prev;
+                prev.next = next;
+                prev = this;
+                next = this;
+                return true;
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Returns true if the list's next reference refers to itself.
+     *
+     * @return true if the list is empty
+     */
+    boolean isListEmpty() {
+        synchronized (list) {
+            return list == list.next;
+        }
+    }
+
+    /**
+     * Unregister this SoftCleanable reference and invoke {@link #performCleanup()},
+     * ensuring at-most-once semantics.
+     */
+    @Override
+    public final void clean() {
+        if (remove()) {
+            super.clear();
+            performCleanup();
+        }
+    }
+
+    /**
+     * Unregister this SoftCleanable and clear the reference.
+     * Due to inherent concurrency, {@link #performCleanup()} may still be invoked.
+     */
+    @Override
+    public void clear() {
+        if (remove()) {
+            super.clear();
+        }
+    }
+
+    /**
+     * The {@code performCleanup} abstract method is overridden
+     * to implement the cleaning logic.
+     * The {@code performCleanup} method should not be called except
+     * by the {@link #clean} method which ensures at most once semantics.
+     */
+    protected abstract void performCleanup();
+
+    /**
+     * This method always throws {@link UnsupportedOperationException}.
+     * Enqueuing details of {@link Cleaner.Cleanable}
+     * are a private implementation detail.
+     *
+     * @throws UnsupportedOperationException always
+     */
+    @Override
+    public final boolean isEnqueued() {
+        throw new UnsupportedOperationException("isEnqueued");
+    }
+
+    /**
+     * This method always throws {@link UnsupportedOperationException}.
+     * Enqueuing details of {@link Cleaner.Cleanable}
+     * are a private implementation detail.
+     *
+     * @throws UnsupportedOperationException always
+     */
+    @Override
+    public final boolean enqueue() {
+        throw new UnsupportedOperationException("enqueue");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/WeakCleanable.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,178 @@
+package jdk.internal.ref;
+
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.lang.ref.Cleaner;
+import java.lang.ref.WeakReference;
+import java.util.Objects;
+
+/**
+ * WeakCleanable subclasses efficiently encapsulate cleanup state and
+ * the cleaning action.
+ * Subclasses implement the abstract {@link #performCleanup()}  method
+ * to provide the cleaning action.
+ * When constructed, the object reference and the {@link Cleaner.Cleanable Cleanable}
+ * are registered with the {@link Cleaner}.
+ * The Cleaner invokes {@link Cleaner.Cleanable#clean() clean} after the
+ * referent becomes weakly reachable.
+ */
+public abstract class WeakCleanable<T> extends WeakReference<T>
+        implements Cleaner.Cleanable {
+
+    /**
+     * Links to previous and next in a doubly-linked list.
+     */
+    WeakCleanable<?> prev = this, next = this;
+
+    /**
+     * The list of WeakCleanable; synchronizes insert and remove.
+     */
+    private final WeakCleanable<?> list;
+
+    /**
+     * Constructs new {@code WeakCleanableReference} with
+     * {@code non-null referent} and {@code non-null cleaner}.
+     * The {@code cleaner} is not retained by this reference; it is only used
+     * to register the newly constructed {@link Cleaner.Cleanable Cleanable}.
+     *
+     * @param referent the referent to track
+     * @param cleaner  the {@code Cleaner} to register new reference with
+     */
+    public WeakCleanable(T referent, Cleaner cleaner) {
+        super(Objects.requireNonNull(referent), CleanerImpl.getCleanerImpl(cleaner).queue);
+        list = CleanerImpl.getCleanerImpl(cleaner).weakCleanableList;
+        insert();
+
+        // TODO: Replace getClass() with ReachabilityFence when it is available
+        cleaner.getClass();
+        referent.getClass();
+    }
+
+    /**
+     * Construct a new root of the list; not inserted.
+     */
+    WeakCleanable() {
+        super(null, null);
+        this.list = this;
+    }
+
+    /**
+     * Insert this WeakCleanableReference after the list head.
+     */
+    private void insert() {
+        synchronized (list) {
+            prev = list;
+            next = list.next;
+            next.prev = this;
+            list.next = this;
+        }
+    }
+
+    /**
+     * Remove this WeakCleanableReference from the list.
+     *
+     * @return true if Cleanable was removed or false if not because
+     * it had already been removed before
+     */
+    private boolean remove() {
+        synchronized (list) {
+            if (next != this) {
+                next.prev = prev;
+                prev.next = next;
+                prev = this;
+                next = this;
+                return true;
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Returns true if the list's next reference refers to itself.
+     *
+     * @return true if the list is empty
+     */
+    boolean isListEmpty() {
+        synchronized (list) {
+            return list == list.next;
+        }
+    }
+
+    /**
+     * Unregister this WeakCleanable reference and invoke {@link #performCleanup()},
+     * ensuring at-most-once semantics.
+     */
+    @Override
+    public final void clean() {
+        if (remove()) {
+            super.clear();
+            performCleanup();
+        }
+    }
+
+    /**
+     * Unregister this WeakCleanable and clear the reference.
+     * Due to inherent concurrency, {@link #performCleanup()} may still be invoked.
+     */
+    @Override
+    public void clear() {
+        if (remove()) {
+            super.clear();
+        }
+    }
+
+    /**
+     * The {@code performCleanup} abstract method is overridden
+     * to implement the cleaning logic.
+     * The {@code performCleanup} method should not be called except
+     * by the {@link #clean} method which ensures at most once semantics.
+     */
+    protected abstract void performCleanup();
+
+    /**
+     * This method always throws {@link UnsupportedOperationException}.
+     * Enqueuing details of {@link Cleaner.Cleanable}
+     * are a private implementation detail.
+     *
+     * @throws UnsupportedOperationException always
+     */
+    @Override
+    public final boolean isEnqueued() {
+        throw new UnsupportedOperationException("isEnqueued");
+    }
+
+    /**
+     * This method always throws {@link UnsupportedOperationException}.
+     * Enqueuing details of {@link Cleaner.Cleanable}
+     * are a private implementation detail.
+     *
+     * @throws UnsupportedOperationException always
+     */
+    @Override
+    public final boolean enqueue() {
+        throw new UnsupportedOperationException("enqueue");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/DontInline.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012, 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.vm.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * A method or constructor may be annotated as "don't inline" if the inlining of
+ * this method should not be performed by the HotSpot VM.
+ * <p>
+ * This annotation must be used sparingly.  It is useful when the only
+ * reasonable alternative is to bind the name of a specific method or
+ * constructor into the HotSpot VM for special handling by the inlining policy.
+ * This annotation must not be relied on as an alternative to avoid tuning the
+ * VM's inlining policy.  In a few cases, it may act as a temporary workaround
+ * until the profiling and inlining performed by the HotSpot VM is sufficiently
+ * improved.
+ *
+ * @implNote
+ * This annotation only takes effect for methods or constructors of classes
+ * loaded by the boot loader.  Annotations on methods or constructors of classes
+ * loaded outside of the boot loader are ignored.
+ */
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface DontInline {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/ForceInline.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012, 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.vm.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * A method or constructor may be annotated as "force inline" if the standard
+ * inlining metrics are to be ignored when the HotSpot VM inlines the method
+ * or constructor.
+ * <p>
+ * This annotation must be used sparingly.  It is useful when the only
+ * reasonable alternative is to bind the name of a specific method or
+ * constructor into the HotSpot VM for special handling by the inlining policy.
+ * This annotation must not be relied on as an alternative to avoid tuning the
+ * VM's inlining policy.  In a few cases, it may act as a temporary workaround
+ * until the profiling and inlining performed by the HotSpot VM is sufficiently
+ * improved.
+ *
+ * @implNote
+ * This annotation only takes effect for methods or constructors of classes
+ * loaded by the boot loader.  Annotations on methods or constructors of classes
+ * loaded outside of the boot loader are ignored.
+ */
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ForceInline {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/Stable.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2012, 2013, 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.vm.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * A field may be annotated as stable if all of its component variables
+ * changes value at most once.
+ * A field's value counts as its component value.
+ * If the field is typed as an array, then all the non-null components
+ * of the array, of depth up to the rank of the field's array type,
+ * also count as component values.
+ * By extension, any variable (either array or field) which has annotated
+ * as stable is called a stable variable, and its non-null or non-zero
+ * value is called a stable value.
+ * <p>
+ * Since all fields begin with a default value of null for references
+ * (resp., zero for primitives), it follows that this annotation indicates
+ * that the first non-null (resp., non-zero) value stored in the field
+ * will never be changed.
+ * <p>
+ * If the field is not of an array type, there are no array elements,
+ * then the value indicated as stable is simply the value of the field.
+ * If the dynamic type of the field value is an array but the static type
+ * is not, the components of the array are <em>not</em> regarded as stable.
+ * <p>
+ * If the field is an array type, then both the field value and
+ * all the components of the field value (if the field value is non-null)
+ * are indicated to be stable.
+ * If the field type is an array type with rank {@code N > 1},
+ * then each component of the field value (if the field value is non-null),
+ * is regarded as a stable array of rank {@code N-1}.
+ * <p>
+ * Fields which are declared {@code final} may also be annotated as stable.
+ * Since final fields already behave as stable values, such an annotation
+ * conveys no additional information regarding change of the field's value, but
+ * still conveys information regarding change of additional components values if
+ * the type of the field is an array type (as described above).
+ * <p>
+ * The HotSpot VM relies on this annotation to promote a non-null (resp.,
+ * non-zero) component value to a constant, thereby enabling superior
+ * optimizations of code depending on such a value (such as constant folding).
+ * More specifically, the HotSpot VM will process non-null stable fields (final
+ * or otherwise) in a similar manner to static final fields with respect to
+ * promoting the field's value to a constant.  Thus, placing aside the
+ * differences for null/non-null values and arrays, a final stable field is
+ * treated as if it is really final from both the Java language and the HotSpot
+ * VM.
+ * <p>
+ * It is (currently) undefined what happens if a field annotated as stable
+ * is given a third value (by explicitly updating a stable field, a component of
+ * a stable array, or a final stable field via reflection or other means).
+ * Since the HotSpot VM promotes a non-null component value to constant, it may
+ * be that the Java memory model would appear to be broken, if such a constant
+ * (the second value of the field) is used as the value of the field even after
+ * the field value has changed (to a third value).
+ *
+ * @implNote
+ * This annotation only takes effect for fields of classes loaded by the boot
+ * loader.  Annoations on fields of classes loaded outside of the boot loader
+ * are ignored.
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Stable {
+}
--- a/jdk/src/java.base/share/classes/jdk/net/ExtendedSocketOptions.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/net/ExtendedSocketOptions.java	Fri Jan 15 19:18:42 2016 +0000
@@ -34,7 +34,6 @@
  *
  * @since 1.8
  */
-@jdk.Exported
 public final class ExtendedSocketOptions {
 
     private static class ExtSocketOption<T> implements SocketOption<T> {
--- a/jdk/src/java.base/share/classes/jdk/net/NetworkPermission.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/net/NetworkPermission.java	Fri Jan 15 19:18:42 2016 +0000
@@ -61,7 +61,6 @@
  * @since 1.8
  */
 
-@jdk.Exported
 public final class NetworkPermission extends BasicPermission {
 
     private static final long serialVersionUID = -2012939586906722291L;
--- a/jdk/src/java.base/share/classes/jdk/net/SocketFlow.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/net/SocketFlow.java	Fri Jan 15 19:18:42 2016 +0000
@@ -45,7 +45,6 @@
  *
  * @since 1.8
  */
-@jdk.Exported
 public class SocketFlow {
 
     private static final int UNSET = -1;
@@ -68,7 +67,6 @@
      *
      * @since 1.8
      */
-    @jdk.Exported
     public enum Status {
         /**
          * Set or get socket option has not been called yet. Status
--- a/jdk/src/java.base/share/classes/jdk/net/Sockets.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/net/Sockets.java	Fri Jan 15 19:18:42 2016 +0000
@@ -55,7 +55,6 @@
  *
  * @see java.nio.channels.NetworkChannel
  */
-@jdk.Exported
 public class Sockets {
 
     private static final HashMap<Class<?>,Set<SocketOption<?>>>
--- a/jdk/src/java.base/share/classes/jdk/net/package-info.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/net/package-info.java	Fri Jan 15 19:18:42 2016 +0000
@@ -30,5 +30,4 @@
  * @since 1.8
  */
 
-@jdk.Exported
 package jdk.net;
--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Fri Jan 15 19:18:42 2016 +0000
@@ -66,6 +66,7 @@
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
+import jdk.internal.misc.VM;
 
 public enum LauncherHelper {
     INSTANCE;
@@ -86,9 +87,9 @@
     private static final String PROP_SETTINGS   = "Property settings:";
     private static final String LOCALE_SETTINGS = "Locale settings:";
 
-    // sync with java.c and sun.misc.VM
+    // sync with java.c and jdk.internal.misc.VM
     private static final String diagprop = "sun.java.launcher.diag";
-    static final boolean trace = sun.misc.VM.getSavedProperty(diagprop) != null;
+    static final boolean trace = VM.getSavedProperty(diagprop) != null;
 
     private static final String defaultBundleName =
             "sun.launcher.resources.launcher";
--- a/jdk/src/java.base/share/classes/sun/misc/MessageUtils.java	Fri Jan 15 08:53:23 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 1995, 2000, 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 sun.misc;
-
-/**
- * MessageUtils: miscellaneous utilities for handling error and status
- * properties and messages.
- *
- * @author Herb Jellinek
- */
-
-public class MessageUtils {
-    // can instantiate it for to allow less verbose use - via instance
-    // instead of classname
-
-    public MessageUtils() { }
-
-    public static String subst(String patt, String arg) {
-        String args[] = { arg };
-        return subst(patt, args);
-    }
-
-    public static String subst(String patt, String arg1, String arg2) {
-        String args[] = { arg1, arg2 };
-        return subst(patt, args);
-    }
-
-    public static String subst(String patt, String arg1, String arg2,
-                               String arg3) {
-        String args[] = { arg1, arg2, arg3 };
-        return subst(patt, args);
-    }
-
-    public static String subst(String patt, String args[]) {
-        StringBuilder result = new StringBuilder();
-        int len = patt.length();
-        for (int i = 0; i >= 0 && i < len; i++) {
-            char ch = patt.charAt(i);
-            if (ch == '%') {
-                if (i != len) {
-                    int index = Character.digit(patt.charAt(i + 1), 10);
-                    if (index == -1) {
-                        result.append(patt.charAt(i + 1));
-                        i++;
-                    } else if (index < args.length) {
-                        result.append(args[index]);
-                        i++;
-                    }
-                }
-            } else {
-                result.append(ch);
-            }
-        }
-        return result.toString();
-    }
-
-    public static String substProp(String propName, String arg) {
-        return subst(System.getProperty(propName), arg);
-    }
-
-    public static String substProp(String propName, String arg1, String arg2) {
-        return subst(System.getProperty(propName), arg1, arg2);
-    }
-
-    public static String substProp(String propName, String arg1, String arg2,
-                                   String arg3) {
-        return subst(System.getProperty(propName), arg1, arg2, arg3);
-    }
-
-    /**
-     *  Print a message directly to stderr, bypassing all the
-     *  character conversion methods.
-     *  @param msg   message to print
-     */
-    public static native void toStderr(String msg);
-
-    /**
-     *  Print a message directly to stdout, bypassing all the
-     *  character conversion methods.
-     *  @param msg   message to print
-     */
-    public static native void toStdout(String msg);
-
-
-    // Short forms of the above
-
-    public static void err(String s) {
-        toStderr(s + "\n");
-    }
-
-    public static void out(String s) {
-        toStdout(s + "\n");
-    }
-
-    // Print a stack trace to stderr
-    //
-    public static void where() {
-        Throwable t = new Throwable();
-        StackTraceElement[] es = t.getStackTrace();
-        for (int i = 1; i < es.length; i++)
-            toStderr("\t" + es[i].toString() + "\n");
-    }
-
-}
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Fri Jan 15 19:18:42 2016 +0000
@@ -25,13 +25,13 @@
 
 package sun.misc;
 
-import java.lang.reflect.Field;
-import java.security.ProtectionDomain;
-
+import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.VM;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
 
-import jdk.internal.HotSpotIntrinsicCandidate;
+import java.lang.reflect.Field;
+import java.security.ProtectionDomain;
 
 
 /**
@@ -1035,9 +1035,4 @@
     private static void throwIllegalAccessError() {
         throw new IllegalAccessError();
     }
-
-    // JVM interface methods
-    private native boolean unalignedAccess0();
-    private native boolean isBigEndian0();
-
 }
--- a/jdk/src/java.base/share/classes/sun/misc/VM.java	Fri Jan 15 08:53:23 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,433 +0,0 @@
-/*
- * Copyright (c) 1996, 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 sun.misc;
-
-import static java.lang.Thread.State.*;
-import java.util.Properties;
-
-public class VM {
-
-    /* The following methods used to be native methods that instruct
-     * the VM to selectively suspend certain threads in low-memory
-     * situations. They are inherently dangerous and not implementable
-     * on native threads. We removed them in JDK 1.2. The skeletons
-     * remain so that existing applications that use these methods
-     * will still work.
-     */
-    private static boolean suspended = false;
-
-    /** @deprecated */
-    @Deprecated
-    public static boolean threadsSuspended() {
-        return suspended;
-    }
-
-    @SuppressWarnings("deprecation")
-    public static boolean allowThreadSuspension(ThreadGroup g, boolean b) {
-        return g.allowThreadSuspension(b);
-    }
-
-    /** @deprecated */
-    @Deprecated
-    public static boolean suspendThreads() {
-        suspended = true;
-        return true;
-    }
-
-    // Causes any suspended threadgroups to be resumed.
-    /** @deprecated */
-    @Deprecated
-    public static void unsuspendThreads() {
-        suspended = false;
-    }
-
-    // Causes threadgroups no longer marked suspendable to be resumed.
-    /** @deprecated */
-    @Deprecated
-    public static void unsuspendSomeThreads() {
-    }
-
-    /* Deprecated fields and methods -- Memory advice not supported in 1.2 */
-
-    /** @deprecated */
-    @Deprecated
-    public static final int STATE_GREEN = 1;
-
-    /** @deprecated */
-    @Deprecated
-    public static final int STATE_YELLOW = 2;
-
-    /** @deprecated */
-    @Deprecated
-    public static final int STATE_RED = 3;
-
-    /** @deprecated */
-    @Deprecated
-    public static final int getState() {
-        return STATE_GREEN;
-    }
-
-    /** @deprecated */
-    @Deprecated
-    public static void registerVMNotification(VMNotification n) { }
-
-    /** @deprecated */
-    @Deprecated
-    public static void asChange(int as_old, int as_new) { }
-
-    /** @deprecated */
-    @Deprecated
-    public static void asChange_otherthread(int as_old, int as_new) { }
-
-    /*
-     * Not supported in 1.2 because these will have to be exported as
-     * JVM functions, and we are not sure we want do that. Leaving
-     * here so it can be easily resurrected -- just remove the //
-     * comments.
-     */
-
-    /**
-     * Resume Java profiling.  All profiling data is added to any
-     * earlier profiling, unless <code>resetJavaProfiler</code> is
-     * called in between.  If profiling was not started from the
-     * command line, <code>resumeJavaProfiler</code> will start it.
-     * <p>
-     *
-     * NOTE: Profiling must be enabled from the command line for a
-     * java.prof report to be automatically generated on exit; if not,
-     * writeJavaProfilerReport must be invoked to write a report.
-     *
-     * @see     resetJavaProfiler
-     * @see     writeJavaProfilerReport
-     */
-
-    // public native static void resumeJavaProfiler();
-
-    /**
-     * Suspend Java profiling.
-     */
-    // public native static void suspendJavaProfiler();
-
-    /**
-     * Initialize Java profiling.  Any accumulated profiling
-     * information is discarded.
-     */
-    // public native static void resetJavaProfiler();
-
-    /**
-     * Write the current profiling contents to the file "java.prof".
-     * If the file already exists, it will be overwritten.
-     */
-    // public native static void writeJavaProfilerReport();
-
-
-    private static volatile boolean booted = false;
-    private static final Object lock = new Object();
-
-    // Invoked by System.initializeSystemClass just before returning.
-    // Subsystems that are invoked during initialization can check this
-    // property in order to avoid doing things that should wait until the
-    // application class loader has been set up.
-    //
-    public static void booted() {
-        synchronized (lock) {
-            booted = true;
-            lock.notifyAll();
-        }
-    }
-
-    public static boolean isBooted() {
-        return booted;
-    }
-
-    // Waits until VM completes initialization
-    //
-    // This method is invoked by the Finalizer thread
-    public static void awaitBooted() throws InterruptedException {
-        synchronized (lock) {
-            while (!booted) {
-                lock.wait();
-            }
-        }
-    }
-
-    // A user-settable upper limit on the maximum amount of allocatable direct
-    // buffer memory.  This value may be changed during VM initialization if
-    // "java" is launched with "-XX:MaxDirectMemorySize=<size>".
-    //
-    // The initial value of this field is arbitrary; during JRE initialization
-    // it will be reset to the value specified on the command line, if any,
-    // otherwise to Runtime.getRuntime().maxMemory().
-    //
-    private static long directMemory = 64 * 1024 * 1024;
-
-    // Returns the maximum amount of allocatable direct buffer memory.
-    // The directMemory variable is initialized during system initialization
-    // in the saveAndRemoveProperties method.
-    //
-    public static long maxDirectMemory() {
-        return directMemory;
-    }
-
-    // User-controllable flag that determines if direct buffers should be page
-    // aligned. The "-XX:+PageAlignDirectMemory" option can be used to force
-    // buffers, allocated by ByteBuffer.allocateDirect, to be page aligned.
-    private static boolean pageAlignDirectMemory;
-
-    // Returns {@code true} if the direct buffers should be page aligned. This
-    // variable is initialized by saveAndRemoveProperties.
-    public static boolean isDirectMemoryPageAligned() {
-        return pageAlignDirectMemory;
-    }
-
-    /**
-     * Returns true if the given class loader is in the system domain
-     * in which all permissions are granted.
-     */
-    public static boolean isSystemDomainLoader(ClassLoader loader) {
-        return loader == null;
-    }
-
-    /**
-     * Returns the system property of the specified key saved at
-     * system initialization time.  This method should only be used
-     * for the system properties that are not changed during runtime.
-     * It accesses a private copy of the system properties so
-     * that user's locking of the system properties object will not
-     * cause the library to deadlock.
-     *
-     * Note that the saved system properties do not include
-     * the ones set by sun.misc.Version.init().
-     *
-     */
-    public static String getSavedProperty(String key) {
-        if (savedProps.isEmpty())
-            throw new IllegalStateException("Should be non-empty if initialized");
-
-        return savedProps.getProperty(key);
-    }
-
-    // TODO: the Property Management needs to be refactored and
-    // the appropriate prop keys need to be accessible to the
-    // calling classes to avoid duplication of keys.
-    private static final Properties savedProps = new Properties();
-
-    // Save a private copy of the system properties and remove
-    // the system properties that are not intended for public access.
-    //
-    // This method can only be invoked during system initialization.
-    public static void saveAndRemoveProperties(Properties props) {
-        if (booted)
-            throw new IllegalStateException("System initialization has completed");
-
-        savedProps.putAll(props);
-
-        // Set the maximum amount of direct memory.  This value is controlled
-        // by the vm option -XX:MaxDirectMemorySize=<size>.
-        // The maximum amount of allocatable direct buffer memory (in bytes)
-        // from the system property sun.nio.MaxDirectMemorySize set by the VM.
-        // The system property will be removed.
-        String s = (String)props.remove("sun.nio.MaxDirectMemorySize");
-        if (s != null) {
-            if (s.equals("-1")) {
-                // -XX:MaxDirectMemorySize not given, take default
-                directMemory = Runtime.getRuntime().maxMemory();
-            } else {
-                long l = Long.parseLong(s);
-                if (l > -1)
-                    directMemory = l;
-            }
-        }
-
-        // Check if direct buffers should be page aligned
-        s = (String)props.remove("sun.nio.PageAlignDirectMemory");
-        if ("true".equals(s))
-            pageAlignDirectMemory = true;
-
-        // Remove other private system properties
-        // used by java.lang.Integer.IntegerCache
-        props.remove("java.lang.Integer.IntegerCache.high");
-
-        // used by sun.launcher.LauncherHelper
-        props.remove("sun.java.launcher.diag");
-    }
-
-    // Initialize any miscellenous operating system settings that need to be
-    // set for the class libraries.
-    //
-    public static void initializeOSEnvironment() {
-        if (!booted) {
-            OSEnvironment.initialize();
-        }
-    }
-
-    /* Current count of objects pending for finalization */
-    private static volatile int finalRefCount;
-
-    /* Peak count of objects pending for finalization */
-    private static volatile int peakFinalRefCount;
-
-    /*
-     * Gets the number of objects pending for finalization.
-     *
-     * @return the number of objects pending for finalization.
-     */
-    public static int getFinalRefCount() {
-        return finalRefCount;
-    }
-
-    /*
-     * Gets the peak number of objects pending for finalization.
-     *
-     * @return the peak number of objects pending for finalization.
-     */
-    public static int getPeakFinalRefCount() {
-        return peakFinalRefCount;
-    }
-
-    /*
-     * Add {@code n} to the objects pending for finalization count.
-     *
-     * @param n an integer value to be added to the objects pending
-     * for finalization count
-     */
-    public static void addFinalRefCount(int n) {
-        // The caller must hold lock to synchronize the update.
-
-        finalRefCount += n;
-        if (finalRefCount > peakFinalRefCount) {
-            peakFinalRefCount = finalRefCount;
-        }
-    }
-
-    /**
-     * Returns Thread.State for the given threadStatus
-     */
-    public static Thread.State toThreadState(int threadStatus) {
-        if ((threadStatus & JVMTI_THREAD_STATE_RUNNABLE) != 0) {
-            return RUNNABLE;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER) != 0) {
-            return BLOCKED;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_INDEFINITELY) != 0) {
-            return WAITING;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) != 0) {
-            return TIMED_WAITING;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_TERMINATED) != 0) {
-            return TERMINATED;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_ALIVE) == 0) {
-            return NEW;
-        } else {
-            return RUNNABLE;
-        }
-    }
-
-    /* The threadStatus field is set by the VM at state transition
-     * in the hotspot implementation. Its value is set according to
-     * the JVM TI specification GetThreadState function.
-     */
-    private static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
-    private static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002;
-    private static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004;
-    private static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400;
-    private static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010;
-    private static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
-
-    /*
-     * Returns the first non-null class loader up the execution stack,
-     * or null if only code from the null class loader is on the stack.
-     */
-    public static native ClassLoader latestUserDefinedLoader();
-
-    /**
-     * Returns {@code true} if we are in a set UID program.
-     */
-    public static boolean isSetUID() {
-        long uid = getuid();
-        long euid = geteuid();
-        long gid = getgid();
-        long egid = getegid();
-        return uid != euid  || gid != egid;
-    }
-
-    /**
-     * Returns the real user ID of the calling process,
-     * or -1 if the value is not available.
-     */
-    public static native long getuid();
-
-    /**
-     * Returns the effective user ID of the calling process,
-     * or -1 if the value is not available.
-     */
-    public static native long geteuid();
-
-    /**
-     * Returns the real group ID of the calling process,
-     * or -1 if the value is not available.
-     */
-    public static native long getgid();
-
-    /**
-     * Returns the effective group ID of the calling process,
-     * or -1 if the value is not available.
-     */
-    public static native long getegid();
-
-    /**
-     * Get a nanosecond time stamp adjustment in the form of a single long.
-     *
-     * This value can be used to create an instant using
-     * {@link java.time.Instant#ofEpochSecond(long, long)
-     *  java.time.Instant.ofEpochSecond(offsetInSeconds,
-     *  getNanoTimeAdjustment(offsetInSeconds))}.
-     * <p>
-     * The value returned has the best resolution available to the JVM on
-     * the current system.
-     * This is usually down to microseconds - or tenth of microseconds -
-     * depending on the OS/Hardware and the JVM implementation.
-     *
-     * @param offsetInSeconds The offset in seconds from which the nanosecond
-     *        time stamp should be computed.
-     *
-     * @apiNote The offset should be recent enough - so that
-     *         {@code offsetInSeconds} is within {@code +/- 2^32} seconds of the
-     *         current UTC time. If the offset is too far off, {@code -1} will be
-     *         returned. As such, {@code -1} must not be considered as a valid
-     *         nano time adjustment, but as an exception value indicating
-     *         that an offset closer to the current time should be used.
-     *
-     * @return A nanosecond time stamp adjustment in the form of a single long.
-     *     If the offset is too far off the current time, this method returns -1.
-     *     In that case, the caller should call this method again, passing a
-     *     more accurate offset.
-     */
-    public static native long getNanoTimeAdjustment(long offsetInSeconds);
-
-    static {
-        initialize();
-    }
-    private static native void initialize();
-}
--- a/jdk/src/java.base/share/classes/sun/misc/VMNotification.java	Fri Jan 15 08:53:23 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1996, 2004, 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 sun.misc;
-
-/** @deprecated */
-@Deprecated
-public interface VMNotification {
-
-    // when the vm switches allocation states, we get notified
-    // (possible semantics: if the state changes while in this
-    // notification, don't recursively notify).
-    // oldState and newState may be the same if we are just releasing
-    // suspended threads.
-    void newAllocState(int oldState, int newState,
-                       boolean threadsSuspended);
-}
--- a/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -967,12 +967,6 @@
         return "";
     }
 
-    @Override
-    protected void finalize() throws Throwable {
-        // This should do nothing.  The stream finalizer will
-        // close the fd.
-    }
-
     public void setDoNotRetry(boolean value) {
         // failedOnce is used to determine if a request should be retried.
         failedOnce = value;
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/jar/URLJarFile.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/jar/URLJarFile.java	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -108,13 +108,6 @@
         return false;
     }
 
-    /*
-     * close the jar file.
-     */
-    protected void finalize() throws IOException {
-        close();
-    }
-
     /**
      * Returns the <code>ZipEntry</code> for the given entry name or
      * <code>null</code> if not found.
--- a/jdk/src/java.base/share/classes/sun/nio/ch/Util.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/Util.java	Fri Jan 15 19:18:42 2016 +0000
@@ -389,7 +389,7 @@
 
     static boolean atBugLevel(String bl) {              // package-private
         if (bugLevel == null) {
-            if (!sun.misc.VM.isBooted())
+            if (!jdk.internal.misc.VM.isBooted())
                 return false;
             String value = AccessController.doPrivileged(
                 new GetPropertyAction("sun.nio.ch.bugLevel"));
--- a/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template	Fri Jan 15 19:18:42 2016 +0000
@@ -156,12 +156,12 @@
 
     private boolean initialized = false;
 
-    /*   provider the sun.nio.cs.map property fir sjis/ms932 mapping hack 
+    /*   provider the sun.nio.cs.map property fir sjis/ms932 mapping hack
      */
     private void init() {
         if (initialized)
             return;
-        if (!sun.misc.VM.isBooted())
+        if (!jdk.internal.misc.VM.isBooted())
             return;
         initialized = true;
 
--- a/jdk/src/java.base/share/classes/sun/reflect/Reflection.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/Reflection.java	Fri Jan 15 19:18:42 2016 +0000
@@ -29,6 +29,7 @@
 import java.util.HashMap;
 import java.util.Map;
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.VM;
 
 /** Common utility routines used by both java.lang and
     java.lang.reflect */
@@ -335,7 +336,7 @@
      */
     public static boolean isCallerSensitive(Method m) {
         final ClassLoader loader = m.getDeclaringClass().getClassLoader();
-        if (sun.misc.VM.isSystemDomainLoader(loader) || isExtClassLoader(loader))  {
+        if (VM.isSystemDomainLoader(loader) || isExtClassLoader(loader))  {
             return m.isAnnotationPresent(CallerSensitive.class);
         }
         return false;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -153,13 +153,11 @@
             getSupportedAlgorithms(AlgorithmConstraints constraints) {
 
         Collection<SignatureAndHashAlgorithm> supported = new ArrayList<>();
-        synchronized (priorityMap) {
-            for (SignatureAndHashAlgorithm sigAlg : priorityMap.values()) {
-                if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM &&
-                        constraints.permits(SIGNATURE_PRIMITIVE_SET,
-                                sigAlg.algorithm, null)) {
-                    supported.add(sigAlg);
-                }
+        for (SignatureAndHashAlgorithm sigAlg : priorityMap.values()) {
+            if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM &&
+                    constraints.permits(SIGNATURE_PRIMITIVE_SET,
+                            sigAlg.algorithm, null)) {
+                supported.add(sigAlg);
             }
         }
 
@@ -417,14 +415,12 @@
             supports(HashAlgorithm.SHA1,        SignatureAlgorithm.ECDSA,
                     "SHA1withECDSA",        --p);
 
-            if (Security.getProvider("SunMSCAPI") == null) {
             supports(HashAlgorithm.SHA224,      SignatureAlgorithm.DSA,
                     "SHA224withDSA",        --p);
             supports(HashAlgorithm.SHA224,      SignatureAlgorithm.RSA,
                     "SHA224withRSA",        --p);
             supports(HashAlgorithm.SHA224,      SignatureAlgorithm.ECDSA,
                     "SHA224withECDSA",      --p);
-            }
 
             supports(HashAlgorithm.SHA256,      SignatureAlgorithm.DSA,
                     "SHA256withDSA",        --p);
--- a/jdk/src/java.base/share/native/libjava/MessageUtils.c	Fri Jan 15 08:53:23 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.
- */
-
-#include <stdlib.h>
-#include <jni.h>
-#include <jni_util.h>
-#include <jlong.h>
-#include <stdio.h>
-#include <jvm.h>
-
-#include "sun_misc_MessageUtils.h"
-
-static void
-printToFile(JNIEnv *env, jstring s, FILE *file)
-{
-    char *sConverted;
-    int length = 0;
-    int i;
-    const jchar *sAsArray;
-
-    if (s == NULL) {
-      s = (*env)->NewStringUTF(env, "null");
-      if (s == NULL) return;
-    }
-
-    sAsArray = (*env)->GetStringChars(env, s, NULL);
-    if (!sAsArray)
-        return;
-    length = (*env)->GetStringLength(env, s);
-    if (length == 0) {
-        (*env)->ReleaseStringChars(env, s, sAsArray);
-        return;
-    }
-    sConverted = (char *) malloc(length + 1);
-    if (!sConverted) {
-        (*env)->ReleaseStringChars(env, s, sAsArray);
-        JNU_ThrowOutOfMemoryError(env, NULL);
-        return;
-    }
-
-    for(i = 0; i < length; i++) {
-        sConverted[i] = (0x7f & sAsArray[i]);
-    }
-    sConverted[length] = '\0';
-    jio_fprintf(file, "%s", sConverted);
-    (*env)->ReleaseStringChars(env, s, sAsArray);
-    free(sConverted);
-}
-
-JNIEXPORT void JNICALL
-Java_sun_misc_MessageUtils_toStderr(JNIEnv *env, jclass cls, jstring s)
-{
-    printToFile(env, s, stderr);
-}
-
-JNIEXPORT void JNICALL
-Java_sun_misc_MessageUtils_toStdout(JNIEnv *env, jclass cls, jstring s)
-{
-    printToFile(env, s, stdout);
-}
--- a/jdk/src/java.base/share/native/libjava/RandomAccessFile.c	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/native/libjava/RandomAccessFile.c	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -103,23 +103,19 @@
 
 JNIEXPORT jlong JNICALL
 Java_java_io_RandomAccessFile_length(JNIEnv *env, jobject this) {
+
     FD fd;
-    jlong cur = jlong_zero;
-    jlong end = jlong_zero;
+    jlong length = jlong_zero;
 
     fd = GET_FD(this, raf_fd);
     if (fd == -1) {
         JNU_ThrowIOException(env, "Stream Closed");
         return -1;
     }
-    if ((cur = IO_Lseek(fd, 0L, SEEK_CUR)) == -1) {
-        JNU_ThrowIOExceptionWithLastError(env, "Seek failed");
-    } else if ((end = IO_Lseek(fd, 0L, SEEK_END)) == -1) {
-        JNU_ThrowIOExceptionWithLastError(env, "Seek failed");
-    } else if (IO_Lseek(fd, cur, SEEK_SET) == -1) {
-        JNU_ThrowIOExceptionWithLastError(env, "Seek failed");
+    if ((length = IO_GetLength(fd)) == -1) {
+        JNU_ThrowIOExceptionWithLastError(env, "GetLength failed");
     }
-    return end;
+    return length;
 }
 
 JNIEXPORT void JNICALL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/native/libjava/StringCoding.c	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+#include <stdlib.h>
+#include <jni.h>
+#include <jni_util.h>
+#include <stdio.h>
+#include <jvm.h>
+
+#include "java_lang_StringCoding.h"
+
+static void
+printToFile(JNIEnv *env, jstring s, FILE *file)
+{
+    char *sConverted;
+    int length = 0;
+    int i;
+    const jchar *sAsArray;
+
+    if (s == NULL) {
+        JNU_ThrowNullPointerException(env, NULL);
+        return;
+    }
+
+    sAsArray = (*env)->GetStringChars(env, s, NULL);
+    if (!sAsArray)
+        return;
+    length = (*env)->GetStringLength(env, s);
+    if (length == 0) {
+        (*env)->ReleaseStringChars(env, s, sAsArray);
+        return;
+    }
+    sConverted = (char *) malloc(length + 1);
+    if (!sConverted) {
+        (*env)->ReleaseStringChars(env, s, sAsArray);
+        JNU_ThrowOutOfMemoryError(env, NULL);
+        return;
+    }
+
+    for(i = 0; i < length; i++) {
+        sConverted[i] = (0x7f & sAsArray[i]);
+    }
+    sConverted[length] = '\0';
+    jio_fprintf(file, "%s", sConverted);
+    (*env)->ReleaseStringChars(env, s, sAsArray);
+    free(sConverted);
+}
+
+JNIEXPORT void JNICALL
+Java_java_lang_StringCoding_err(JNIEnv *env, jclass cls, jstring s)
+{
+    printToFile(env, s, stderr);
+}
--- a/jdk/src/java.base/share/native/libjava/VM.c	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/share/native/libjava/VM.c	Fri Jan 15 19:18:42 2016 +0000
@@ -28,7 +28,7 @@
 #include "jvm.h"
 #include "jdk_util.h"
 
-#include "sun_misc_VM.h"
+#include "jdk_internal_misc_VM.h"
 
 /* Only register the performance-critical methods */
 static JNINativeMethod methods[] = {
@@ -36,12 +36,12 @@
 };
 
 JNIEXPORT jobject JNICALL
-Java_sun_misc_VM_latestUserDefinedLoader(JNIEnv *env, jclass cls) {
+Java_jdk_internal_misc_VM_latestUserDefinedLoader(JNIEnv *env, jclass cls) {
     return JVM_LatestUserDefinedLoader(env);
 }
 
 JNIEXPORT void JNICALL
-Java_sun_misc_VM_initialize(JNIEnv *env, jclass cls) {
+Java_jdk_internal_misc_VM_initialize(JNIEnv *env, jclass cls) {
     if (!JDK_InitJvmHandle()) {
         JNU_ThrowInternalError(env, "Handle for JVM not found for symbol lookup");
         return;
@@ -50,8 +50,8 @@
     // Registers implementations of native methods described in methods[]
     // above.
     // In particular, registers JVM_GetNanoTimeAdjustment as the implementation
-    // of the native sun.misc.VM.getNanoTimeAdjustment - avoiding the cost of
-    // introducing a Java_sun_misc_VM_getNanoTimeAdjustment  wrapper
+    // of the native VM.getNanoTimeAdjustment - avoiding the cost of
+    // introducing a Java_jdk_internal_misc_VM_getNanoTimeAdjustment wrapper
     (*env)->RegisterNatives(env, cls,
                             methods, sizeof(methods)/sizeof(methods[0]));
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/unix/classes/jdk/internal/misc/OSEnvironment.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2005, 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.misc;
+
+public class OSEnvironment {
+
+    /*
+     * Initialize any miscellaneous operating system settings that need to be set
+     * for the class libraries.
+     */
+    public static void initialize() {
+        // no-op on Solaris and Linux
+    }
+
+}
--- a/jdk/src/java.base/unix/classes/sun/misc/OSEnvironment.java	Fri Jan 15 08:53:23 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2005, 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 sun.misc;
-
-public class OSEnvironment {
-
-    /*
-     * Initialize any miscellenous operating system settings that need to be set
-     * for the class libraries.
-     */
-    public static void initialize() {
-        // no-op on Solaris and Linux
-    }
-
-}
--- a/jdk/src/java.base/unix/native/libjava/VM_md.c	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/unix/native/libjava/VM_md.c	Fri Jan 15 19:18:42 2016 +0000
@@ -28,25 +28,25 @@
 
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
 
     return getuid();
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
 
     return geteuid();
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
 
     return getgid();
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
 
     return getegid();
 }
--- a/jdk/src/java.base/unix/native/libjava/io_util_md.c	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/unix/native/libjava/io_util_md.c	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -22,7 +22,6 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 #include "jni.h"
 #include "jni_util.h"
 #include "jvm.h"
@@ -219,3 +218,14 @@
     RESTARTABLE(ftruncate64(fd, length), result);
     return result;
 }
+
+jlong
+handleGetLength(FD fd)
+{
+    struct stat64 sb;
+    if (fstat64(fd, &sb) == 0) {
+        return sb.st_size;
+    } else {
+        return -1;
+    }
+}
--- a/jdk/src/java.base/unix/native/libjava/io_util_md.h	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/unix/native/libjava/io_util_md.h	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -39,7 +39,7 @@
 ssize_t handleRead(FD fd, void *buf, jint len);
 jint handleAvailable(FD fd, jlong *pbytes);
 jint handleSetLength(FD fd, jlong length);
-
+jlong handleGetLength(FD fd);
 FD handleOpen(const char *path, int oflag, int mode);
 
 /*
@@ -72,6 +72,7 @@
 #define IO_Append handleWrite
 #define IO_Available handleAvailable
 #define IO_SetLength handleSetLength
+#define IO_GetLength handleGetLength
 
 #ifdef _ALLBSD_SOURCE
 #define open64 open
--- a/jdk/src/java.base/unix/native/libnio/ch/NativeThread.c	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/unix/native/libnio/ch/NativeThread.c	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -93,6 +93,10 @@
 #else
     ret = pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL);
 #endif
+#ifdef MACOSX
+    if (ret != 0 && ret != ESRCH)
+#else
     if (ret != 0)
+#endif
         JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
 }
--- a/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java	Fri Jan 15 19:18:42 2016 +0000
@@ -42,8 +42,10 @@
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+
 import jdk.internal.misc.JavaIOFileDescriptorAccess;
 import jdk.internal.misc.SharedSecrets;
+import jdk.internal.ref.CleanerFactory;
 
 /* This class is for the exclusive use of ProcessBuilder.start() to
  * create new processes.
@@ -417,6 +419,10 @@
 
         handle = create(cmdstr, envblock, path,
                         stdHandles, redirectErrorStream);
+        // Register a cleaning function to close the handle
+        final long local_handle = handle;    // local to prevent capture of this
+        CleanerFactory.cleaner().register(this, () -> closeHandle(local_handle));
+
         processHandle = ProcessHandleImpl.getInternal(getProcessId0(handle));
 
         java.security.AccessController.doPrivileged(
@@ -463,10 +469,6 @@
         return stderr_stream;
     }
 
-    protected void finalize() {
-        closeHandle(handle);
-    }
-
     private static final int STILL_ACTIVE = getStillActive();
     private static native int getStillActive();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/windows/classes/jdk/internal/misc/OSEnvironment.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2005, 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.misc;
+
+import sun.io.Win32ErrorMode;
+
+public class OSEnvironment {
+
+    /*
+     * Initialize any miscellaneous operating system settings that need to be set
+     * for the class libraries.
+     * <p>
+     * At this time only the process-wide error mode needs to be set.
+     */
+    public static void initialize() {
+        Win32ErrorMode.initialize();
+    }
+
+}
--- a/jdk/src/java.base/windows/classes/sun/io/Win32ErrorMode.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/windows/classes/sun/io/Win32ErrorMode.java	Fri Jan 15 19:18:42 2016 +0000
@@ -66,7 +66,7 @@
      * has completed.
      */
     public static void initialize() {
-        if (!sun.misc.VM.isBooted()) {
+        if (!jdk.internal.misc.VM.isBooted()) {
             String s = System.getProperty("sun.io.allowCriticalErrorMessageBox");
             if (s == null || s.equals(Boolean.FALSE.toString())) {
                 long mode = setErrorMode(0);
--- a/jdk/src/java.base/windows/classes/sun/misc/OSEnvironment.java	Fri Jan 15 08:53:23 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2005, 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 sun.misc;
-
-import sun.io.Win32ErrorMode;
-
-public class OSEnvironment {
-
-    /*
-     * Initialize any miscellenous operating system settings that need to be set
-     * for the class libraries.
-     * <p>
-     * At this time only the process-wide error mode needs to be set.
-     */
-    public static void initialize() {
-        Win32ErrorMode.initialize();
-    }
-
-}
--- a/jdk/src/java.base/windows/native/libjava/VM_md.c	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/windows/native/libjava/VM_md.c	Fri Jan 15 19:18:42 2016 +0000
@@ -27,28 +27,28 @@
 
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
 
     /* -1 means function not available. */
     return -1;
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
 
     /* -1 means function not available. */
     return -1;
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
 
     /* -1 means function not available. */
     return -1;
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
 
     /* -1 means function not available. */
     return -1;
--- a/jdk/src/java.base/windows/native/libjava/io_util_md.c	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/windows/native/libjava/io_util_md.c	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -584,3 +584,14 @@
     }
     return long_to_jlong(pos.QuadPart);
 }
+
+jlong
+handleGetLength(FD fd) {
+    HANDLE h = (HANDLE) fd;
+    LARGE_INTEGER length;
+    if (GetFileSizeEx(h, &length) != 0) {
+        return long_to_jlong(length.QuadPart);
+    } else {
+        return -1;
+    }
+}
--- a/jdk/src/java.base/windows/native/libjava/io_util_md.h	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.base/windows/native/libjava/io_util_md.h	Fri Jan 15 19:18:42 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -44,6 +44,7 @@
 int handleAvailable(FD fd, jlong *pbytes);
 int handleSync(FD fd);
 int handleSetLength(FD fd, jlong length);
+jlong handleGetLength(FD fd);
 JNIEXPORT jint handleRead(FD fd, void *buf, jint len);
 jint handleWrite(FD fd, const void *buf, jint len);
 jint handleAppend(FD fd, const void *buf, jint len);
@@ -84,6 +85,7 @@
 #define IO_Lseek handleLseek
 #define IO_Available handleAvailable
 #define IO_SetLength handleSetLength
+#define IO_GetLength handleGetLength
 
 /*
  * Setting the handle field in Java_java_io_FileDescriptor_set for
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java	Fri Jan 15 19:18:42 2016 +0000
@@ -35,8 +35,6 @@
 import java.util.Enumeration;
 import java.net.URL;
 
-import sun.misc.MessageUtils;
-
 /**
  * A simple DTD-driven HTML parser. The parser reads an
  * HTML file from an InputStream and calls various methods
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Fri Jan 15 19:18:42 2016 +0000
@@ -44,7 +44,6 @@
 import sun.awt.EmbeddedFrame;
 import sun.awt.SunToolkit;
 import sun.misc.ManagedLocalsThread;
-import sun.misc.MessageUtils;
 import sun.misc.PerformanceLogger;
 import sun.security.util.SecurityConstants;
 
@@ -118,8 +117,6 @@
      */
     Dimension currentAppletSize = new Dimension(10, 10);
 
-    MessageUtils mu = new MessageUtils();
-
     /**
      * The thread to use during applet loading
      */
--- a/jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java	Fri Jan 15 19:18:42 2016 +0000
@@ -639,7 +639,7 @@
                     continue;
                 } else if (ch2 == 'h') {
                     file = new File(System.getProperty("user.home"));
-                    if (sun.misc.VM.isSetUID()) {
+                    if (jdk.internal.misc.VM.isSetUID()) {
                         // Ok, we are in a set UID program.  For safety's sake
                         // we disallow attempts to open files relative to %h.
                         throw new IOException("can't use %h in set UID program");
--- a/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java	Fri Jan 15 19:18:42 2016 +0000
@@ -583,7 +583,7 @@
         ClassLoader loader =
             AccessController.doPrivileged(
                 (PrivilegedAction<ClassLoader>) () -> cls.getClassLoader());
-        if (!sun.misc.VM.isSystemDomainLoader(loader)) {
+        if (!jdk.internal.misc.VM.isSystemDomainLoader(loader)) {
             throw new IllegalArgumentException(mxbeanName +
                 " is not a platform MXBean");
         }
--- a/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java	Fri Jan 15 19:18:42 2016 +0000
@@ -473,7 +473,7 @@
     public static Thread.State toThreadState(int state) {
         // suspended and native bits may be set in state
         int threadStatus = state & ~JMM_THREAD_STATE_FLAG_MASK;
-        return sun.misc.VM.toThreadState(threadStatus);
+        return jdk.internal.misc.VM.toThreadState(threadStatus);
     }
 
     // These values are defined in jmm.h
--- a/jdk/src/java.management/share/classes/sun/management/MemoryImpl.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/MemoryImpl.java	Fri Jan 15 19:18:42 2016 +0000
@@ -59,7 +59,7 @@
     }
 
     public int getObjectPendingFinalizationCount() {
-        return sun.misc.VM.getFinalRefCount();
+        return jdk.internal.misc.VM.getFinalRefCount();
     }
 
     public void gc() {
--- a/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalInputStream.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalInputStream.java	Fri Jan 15 19:18:42 2016 +0000
@@ -262,7 +262,7 @@
      * if only code from the null class loader is on the stack.
      */
     private static ClassLoader latestUserDefinedLoader() {
-        return sun.misc.VM.latestUserDefinedLoader();
+        return jdk.internal.misc.VM.latestUserDefinedLoader();
     }
 
     /**
--- a/jdk/src/java.scripting/share/classes/javax/script/ScriptEngineFactory.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.scripting/share/classes/javax/script/ScriptEngineFactory.java	Fri Jan 15 19:18:42 2016 +0000
@@ -31,12 +31,14 @@
  * <code>ScriptEngineFactory</code> is used to describe and instantiate
  * <code>ScriptEngines</code>.
  * <br><br>
- * Each class implementing <code>ScriptEngine</code> has a corresponding factory
- * that exposes metadata describing the engine class.
+ * Each class implementing <code>ScriptEngine</code> has a corresponding
+ * factory that exposes metadata describing the engine class.
  * <br><br>The <code>ScriptEngineManager</code>
- * uses the service provider mechanism described in the <i>Jar File Specification</i> to obtain
- * instances of all <code>ScriptEngineFactories</code> available in
- * the current ClassLoader.
+ * uses the service-provider loader mechanism described in the
+ * {@link java.util.ServiceLoader} class to obtain
+ * instances of {@code ScriptEngineFactory} instances.
+ * See {@link ScriptEngineManager#ScriptEngineManager()} and
+ * {@link ScriptEngineManager#ScriptEngineManager(java.lang.ClassLoader)}.
  *
  * @since 1.6
  */
--- a/jdk/src/java.scripting/share/classes/javax/script/ScriptEngineManager.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.scripting/share/classes/javax/script/ScriptEngineManager.java	Fri Jan 15 19:18:42 2016 +0000
@@ -33,7 +33,8 @@
  * The <code>ScriptEngineManager</code> implements a discovery and instantiation
  * mechanism for <code>ScriptEngine</code> classes and also maintains a
  * collection of key/value pairs storing state shared by all engines created
- * by the Manager. This class uses the <a href="../../../technotes/guides/jar/jar.html#Service%20Provider">service provider</a> mechanism to enumerate all the
+ * by the Manager. This class uses the service provider mechanism described in the
+ * {@link java.util.ServiceLoader} class to enumerate all the
  * implementations of <code>ScriptEngineFactory</code>. <br><br>
  * The <code>ScriptEngineManager</code> provides a method to return a list of all these factories
  * as well as utility methods which look up factories on the basis of language name, file extension
@@ -64,7 +65,7 @@
     /**
      * This constructor loads the implementations of
      * <code>ScriptEngineFactory</code> visible to the given
-     * <code>ClassLoader</code> using the <a href="../../../technotes/guides/jar/jar.html#Service%20Provider">service provider</a> mechanism.<br><br>
+     * <code>ClassLoader</code> using the service provider mechanism.<br><br>
      * If loader is <code>null</code>, the script engine factories that are
      * bundled with the platform are loaded. <br>
      *
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.scripting/share/classes/javax/script/package-info.java	Fri Jan 15 19:18:42 2016 +0000
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2005, 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.
+ */
+
+/**
+
+<p>The scripting API consists of interfaces and classes that define
+Java&trade; Scripting Engines and provides
+a framework for their use in Java applications. This API is intended
+for use by application programmers who wish to execute programs
+written in scripting languages in their Java applications. The
+scripting language programs are usually provided by the end-users of
+the applications.
+</p>
+<p>The main areas of functionality of <code>javax.script</code>
+package include
+</p>
+<ol>
+<li><p><b>Script execution</b>: Scripts
+are streams of characters used as sources for  programs executed by
+script engines. Script execution uses
+{@link javax.script.ScriptEngine#eval eval} methods of
+{@link javax.script.ScriptEngine ScriptEngine} and methods of the
+{@link javax.script.Invocable Invocable} interface.
+</p>
+<li><p><b>Binding</b>: This facility
+allows Java objects to be exposed to script programs as named
+variables. {@link javax.script.Bindings Bindings} and
+{@link javax.script.ScriptContext ScriptContext}
+classes are used for this purpose.
+</p>
+<li><p><b>Compilation</b>: This
+functionality allows the intermediate code generated by the
+front-end of a script engine to be stored and executed repeatedly.
+This benefits applications that execute the same script multiple
+times. These applications can gain efficiency since the engines'
+front-ends only need to execute once per script rather than once per
+script execution. Note that this functionality is optional and
+script engines may choose not to implement it. Callers need to check
+for availability of the {@link javax.script.Compilable Compilable}
+interface using an <I>instanceof</I> check.
+</p>
+<li><p><b>Invocation</b>: This
+functionality allows the reuse of intermediate code generated by a
+script engine's front-end. Whereas Compilation allows entire scripts
+represented by intermediate code to be re-executed, Invocation
+functionality allows individual procedures/methods in the scripts to
+be re-executed. As in the case with compilation, not all script
+engines are required to provide this facility. Caller has to check
+for {@link javax.script.Invocable Invocable} availability.
+</p>
+<li><p><b>Script engine discovery</b>: Applications
+written to the Scripting API might have specific requirements on
+script engines. Some may require a specific scripting language
+and/or version while others may require a specific implementation
+engine and/or version. Script engines are packaged in a specified
+way so that engines can be discovered at runtime and queried for
+attributes. The Engine discovery mechanism is based on the service-provider
+loading facility described in the {@link java.util.ServiceLoader} class.
+{@link javax.script.ScriptEngineManager ScriptEngineManager}
+includes
+{@link javax.script.ScriptEngineManager#getEngineFactories getEngineFactories} method to get all
+{@link javax.script.ScriptEngineFactory ScriptEngineFactory} instances
+discovered using this mechanism. <code>ScriptEngineFactory</code> has
+methods to query attributes about script engine.
+</p>
+</ol>
+
+@since 1.6
+*/
+
+package javax.script;
+
--- a/jdk/src/java.scripting/share/classes/javax/script/package.html	Fri Jan 15 08:53:23 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body bgcolor="white">
-<p>The scripting API consists of interfaces and classes that define
-Java&trade; Scripting Engines and provides
-a framework for their use in Java applications. This API is intended
-for use by application programmers who wish to execute programs
-written in scripting languages in their Java applications. The
-scripting language programs are usually provided by the end-users of
-the applications. 
-</p>
-<p>The main areas of functionality of <code>javax.script</code>
-package include 
-</p>
-<ol>
-	<li><p><b>Script execution</b>: Scripts
-	are streams of characters used as sources for  programs executed by
-	script engines. Script execution uses 
-        {@link javax.script.ScriptEngine#eval eval} methods of
-	{@link javax.script.ScriptEngine ScriptEngine} and methods of the 
-        {@link javax.script.Invocable Invocable} interface. 
-	</p>
-	<li><p><b>Binding</b>: This facility
-	allows Java objects to be exposed to script programs as named
-	variables. {@link javax.script.Bindings Bindings} and 
-        {@link javax.script.ScriptContext ScriptContext}
-	classes are used for this purpose. 
-	</p>
-	<li><p><b>Compilation</b>: This
-	functionality allows the intermediate code generated by the
-	front-end of a script engine to be stored and executed repeatedly.
-	This benefits applications that execute the same script multiple
-	times. These applications can gain efficiency since the engines'
-	front-ends only need to execute once per script rather than once per
-	script execution. Note that this functionality is optional and
-	script engines may choose not to implement it. Callers need to check
-	for availability of the {@link javax.script.Compilable Compilable}
-        interface using an <I>instanceof</I> check. 
-	</p>
-	<li><p><b>Invocation</b>: This
-	functionality allows the reuse of intermediate code generated by a
-	script engine's front-end. Whereas Compilation allows entire scripts
-	represented by intermediate code to be re-executed, Invocation
-	functionality allows individual procedures/methods in the scripts to
-	be re-executed. As in the case with compilation, not all script
-	engines are required to provide this facility. Caller has to check
-	for {@link javax.script.Invocable Invocable} availability. 
-	</p>
-	<li><p><b>Script engine discovery and Metadata</b>: Applications
-	written to the Scripting API might have specific requirements on
-	script engines. Some may require a specific scripting language
-	and/or version while others may require a specific implementation
-	engine and/or version. Script engines are packaged in a specified
-	way so that engines can be discovered at runtime and queried for
-	attributes. The Engine discovery mechanism is based on the Service
-	discovery mechanism described in the <b>Jar File Specification</b>.
-	Script engine implementing classes are packaged in jar files that
-	include a  text resource named
-	<b>META-INF/services/javax.script.ScriptEngineFactory</b>. This
-	resource must include a line for each 
-        {@link javax.script.ScriptEngineFactory ScriptEngineFactory}
-	that is packaged in the jar file. 
-        {@link javax.script.ScriptEngineManager ScriptEngineManager}
-	includes 
-        {@link javax.script.ScriptEngineManager#getEngineFactories getEngineFactories} method to get all
-	{@link javax.script.ScriptEngineFactory ScriptEngineFactory} instances 
-        discovered using this mechanism. <code>ScriptEngineFactory</code> has 
-        methods to query attributes about script engine.
-	</p>
-</ol>
-
-@since 1.6
-
-</body>
-</html>
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	Fri Jan 15 19:18:42 2016 +0000
@@ -397,7 +397,7 @@
          */
 
         if (osname != null && !osname.startsWith("Windows")) {
-            long uid = sun.misc.VM.getuid();
+            long uid = jdk.internal.misc.VM.getuid();
             if (uid != -1) {
                 name = File.separator + "tmp" +
                         File.separator + stdCacheNameComponent + "_" + uid;
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java	Fri Jan 15 19:18:42 2016 +0000
@@ -60,7 +60,7 @@
  *
  *    service_euid
  *
- * in which euid is available as sun.misc.VM.geteuid().
+ * in which euid is available as jdk.internal.misc.VM.geteuid().
  *
  * The file has a header:
  *
@@ -107,7 +107,7 @@
     private static long uid;
     static {
         // Available on Solaris, Linux and Mac. Otherwise, -1 and no _euid suffix
-        uid = sun.misc.VM.geteuid();
+        uid = jdk.internal.misc.VM.geteuid();
     }
 
     public DflCache (String source) {
--- a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AWTEventMonitor.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AWTEventMonitor.java	Fri Jan 15 19:18:42 2016 +0000
@@ -45,7 +45,6 @@
  * level support for capturing the top-level containers as they are created.
  */
 
-@jdk.Exported
 public class AWTEventMonitor {
 
     /**
--- a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityEventMonitor.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityEventMonitor.java	Fri Jan 15 19:18:42 2016 +0000
@@ -43,7 +43,6 @@
  *
  */
 
-@jdk.Exported
 public class AccessibilityEventMonitor {
 
     // listeners
--- a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityListenerList.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityListenerList.java	Fri Jan 15 19:18:42 2016 +0000
@@ -37,7 +37,6 @@
  *
  */
 
-@jdk.Exported
 public class AccessibilityListenerList {
     /* A null array to be shared by all empty listener lists */
     private final static Object[] NULL_ARRAY = new Object[0];
--- a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/EventID.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/EventID.java	Fri Jan 15 19:18:42 2016 +0000
@@ -35,7 +35,6 @@
  * @see SwingEventMonitor
  *
  */
-@jdk.Exported
 public class EventID {
 
     /**
--- a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/EventQueueMonitor.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/EventQueueMonitor.java	Fri Jan 15 19:18:42 2016 +0000
@@ -40,7 +40,6 @@
  * @see AWTEventMonitor
  * @see SwingEventMonitor
  */
-@jdk.Exported
 public class EventQueueMonitor
         implements AWTEventListener {
 
--- a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/GUIInitializedListener.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/GUIInitializedListener.java	Fri Jan 15 19:18:42 2016 +0000
@@ -49,7 +49,6 @@
  * @see EventQueueMonitor#removeGUIInitializedListener
  *
  */
-@jdk.Exported
 public interface GUIInitializedListener extends EventListener {
 
     /**
--- a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/SwingEventMonitor.java	Fri Jan 15 08:53:23 2016 -0800
+++ b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/SwingEventMonitor.java	Fri Jan 15 19:18:42 2016 +0000
@@ -56,7 +56,6 @@
  * @see AWTEventMonitor
  *
  */
-@jdk.Exported
 public class SwingEventMonitor extends AWTEventMonitor {
 
     /**
--- a/j