changeset 35565:ba5fe4d701e4

Merge
author thartmann
date Fri, 15 Jan 2016 09:15:33 +0100
parents 3485bf43b924 5e373cc222a5
children 034e1bc6f382
files hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java hotspot/src/share/vm/prims/jvm.cpp 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/CEFormatException.java jdk/src/java.base/share/classes/sun/misc/CEStreamExhausted.java jdk/src/java.base/share/classes/sun/misc/JarFilter.java jdk/src/java.base/share/classes/sun/misc/MessageUtils.java jdk/src/java.base/share/classes/sun/misc/Perf.java jdk/src/java.base/share/classes/sun/misc/PerfCounter.java jdk/src/java.base/share/classes/sun/misc/PerformanceLogger.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/api/T6430241.java langtools/test/tools/javac/file/BootClassPathPrepend.java langtools/test/tools/javac/util/context/T7021650.java langtools/test/tools/sjavac/ExclPattern.java nashorn/test/src/jdk/internal/dynalink/beans/test/CallerSensitiveTest.java
diffstat 800 files changed, 10681 insertions(+), 7301 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Jan 14 14:34:36 2016 +0100
+++ b/.hgtags	Fri Jan 15 09:15:33 2016 +0100
@@ -342,3 +342,5 @@
 4edcff1b9a8875eb6380a2165dfec599e8e3f7c0 jdk-9+97
 d00ad2d9049ac60815f70bff445e95df85648bd2 jdk-9+98
 f9bcdce2df26678c3fe468130b535c0342c69b89 jdk-9+99
+4379223f8806626852c46c52d4e7a27a584b406e jdk-9+100
+80f67512daa15cf37b4825c1c62a675d524d7c49 jdk-9+101
--- a/.hgtags-top-repo	Thu Jan 14 14:34:36 2016 +0100
+++ b/.hgtags-top-repo	Fri Jan 15 09:15:33 2016 +0100
@@ -342,3 +342,5 @@
 75c3897541ecb52ee16d001ea605b12971df7303 jdk-9+97
 48987460c7d49a29013963ee44d090194396bb61 jdk-9+98
 7c0577bea4c65d69c5bef67023a89d2efa4fb2f7 jdk-9+99
+c1f30ac14db0eaff398429c04cd9fab92e1b4b2a jdk-9+100
+c4d72a1620835b5d657b7b6792c2879367d0154f jdk-9+101
--- a/common/autoconf/basics.m4	Thu Jan 14 14:34:36 2016 +0100
+++ b/common/autoconf/basics.m4	Fri Jan 15 09:15:33 2016 +0100
@@ -23,6 +23,74 @@
 # questions.
 #
 
+# Create a function/macro that takes a series of named arguments. The call is
+# similar to AC_DEFUN, but the setup of the function looks like this:
+# BASIC_DEFUN_NAMED([MYFUNC], [FOO *BAR], [$@], [
+# ... do something
+#   AC_MSG_NOTICE([Value of BAR is ARG_BAR])
+# ])
+# A star (*) in front of a named argument means that it is required and it's
+# presence will be verified. To pass e.g. the first value as a normal indexed
+# argument, use [m4_shift($@)] as the third argument instead of [$@]. These
+# arguments are referenced in the function by their name prefixed by ARG_, e.g.
+# "ARG_FOO".
+#
+# The generated function can be called like this:
+# MYFUNC(FOO: [foo-val], BAR:
+#     [
+#         $ECHO hello world
+#     ])
+#
+#
+# Argument 1: Name of the function to define
+# Argument 2: List of legal named arguments, with a * prefix for required arguments
+# Argument 3: Argument array to treat as named, typically $@
+# Argument 4: The main function body
+AC_DEFUN([BASIC_DEFUN_NAMED],
+[
+  AC_DEFUN($1, [
+    m4_foreach(arg, m4_split($2), [
+      m4_if(m4_bregexp(arg, [^\*]), -1,
+        [
+          m4_set_add(legal_named_args, arg)
+        ],
+        [
+          m4_set_add(legal_named_args, m4_substr(arg, 1))
+          m4_set_add(required_named_args, m4_substr(arg, 1))
+        ]
+      )
+    ])
+
+    m4_foreach([arg], [$3], [
+      m4_define(arg_name, m4_substr(arg, 0, m4_bregexp(arg, [: ])))
+      m4_set_contains(legal_named_args, arg_name, [],[AC_MSG_ERROR([Internal error: arg_name is not a valid named argument to [$1]. Valid arguments are 'm4_set_contents(legal_named_args, [ ])'.])])
+      m4_set_remove(required_named_args, arg_name)
+      m4_set_remove(legal_named_args, arg_name)
+      m4_pushdef([ARG_][]arg_name, m4_substr(arg, m4_incr(m4_incr(m4_bregexp(arg, [: ])))))
+      m4_set_add(defined_args, arg_name)
+      m4_undefine([arg_name])
+    ])
+    m4_set_empty(required_named_args, [], [
+      AC_MSG_ERROR([Internal error: Required named arguments are missing for [$1]. Missing arguments: 'm4_set_contents(required_named_args, [ ])'])
+    ])
+    m4_foreach([arg], m4_indir([m4_dquote]m4_set_listc([legal_named_args])), [
+      m4_pushdef([ARG_][]arg, [])
+      m4_set_add(defined_args, arg)
+    ])
+    m4_set_delete(legal_named_args)
+    m4_set_delete(required_named_args)
+
+    # Execute function body
+    $4
+
+    m4_foreach([arg], m4_indir([m4_dquote]m4_set_listc([defined_args])), [
+      m4_popdef([ARG_][]arg)
+    ])
+
+    m4_set_delete(defined_args)
+  ])
+])
+
 # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
 # If so, then append $1 to $2 \
 # Also set JVM_ARG_OK to true/false depending on outcome.
@@ -1122,7 +1190,6 @@
 
   # Move configure.log from current directory to the build output root
   if test -e ./configure.log; then
-    echo found it
     $MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
   fi
 
--- a/common/autoconf/build-performance.m4	Thu Jan 14 14:34:36 2016 +0100
+++ b/common/autoconf/build-performance.m4	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/common/autoconf/flags.m4	Fri Jan 15 09:15:33 2016 +0100
@@ -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)
@@ -405,7 +425,7 @@
       # Add runtime stack smashing and undefined behavior checks.
       # Not all versions of gcc support -fstack-protector
       STACK_PROTECTOR_CFLAG="-fstack-protector-all"
-      FLAGS_COMPILER_CHECK_ARGUMENTS([$STACK_PROTECTOR_CFLAG], [], [STACK_PROTECTOR_CFLAG=""])
+      FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$STACK_PROTECTOR_CFLAG], IF_FALSE: [STACK_PROTECTOR_CFLAG=""])
 
       CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
       CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
@@ -722,7 +742,7 @@
       -I${JDK_TOPDIR}/src/java.base/share/native/include \
       -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
       -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include \
-      -I${JDK_TOPDIR}/src/java.base/share/native/libjava \ 
+      -I${JDK_TOPDIR}/src/java.base/share/native/libjava \
       -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava"
 
   # The shared libraries are compiled using the picflag.
@@ -876,17 +896,18 @@
   AC_SUBST(LDFLAGS_TESTEXE)
 ])
 
-# FLAGS_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                   [RUN-IF-FALSE])
+# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
+#                                   IF_FALSE: [RUN-IF-FALSE])
 # ------------------------------------------------------------
 # Check that the c and c++ compilers support an argument
-AC_DEFUN([FLAGS_COMPILER_CHECK_ARGUMENTS],
+BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
+    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 [
-  AC_MSG_CHECKING([if compiler supports "$1"])
+  AC_MSG_CHECKING([if compiler supports "ARG_ARGUMENT"])
   supports=yes
 
   saved_cflags="$CFLAGS"
-  CFLAGS="$CFLAGS $1"
+  CFLAGS="$CFLAGS ARG_ARGUMENT"
   AC_LANG_PUSH([C])
   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
       [supports=no])
@@ -894,7 +915,7 @@
   CFLAGS="$saved_cflags"
 
   saved_cxxflags="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAG $1"
+  CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
   AC_LANG_PUSH([C++])
   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
       [supports=no])
@@ -903,23 +924,26 @@
 
   AC_MSG_RESULT([$supports])
   if test "x$supports" = "xyes" ; then
-    m4_ifval([$2], [$2], [:])
+    :
+    ARG_IF_TRUE
   else
-    m4_ifval([$3], [$3], [:])
+    :
+    ARG_IF_FALSE
   fi
 ])
 
-# FLAGS_LINKER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                    [RUN-IF-FALSE])
+# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
+#                                   IF_FALSE: [RUN-IF-FALSE])
 # ------------------------------------------------------------
 # Check that the linker support an argument
-AC_DEFUN([FLAGS_LINKER_CHECK_ARGUMENTS],
+BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
+    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 [
-  AC_MSG_CHECKING([if linker supports "$1"])
+  AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
   supports=yes
 
   saved_ldflags="$LDFLAGS"
-  LDFLAGS="$LDFLAGS $1"
+  LDFLAGS="$LDFLAGS ARG_ARGUMENT"
   AC_LANG_PUSH([C])
   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
       [], [supports=no])
@@ -928,9 +952,11 @@
 
   AC_MSG_RESULT([$supports])
   if test "x$supports" = "xyes" ; then
-    m4_ifval([$2], [$2], [:])
+    :
+    ARG_IF_TRUE
   else
-    m4_ifval([$3], [$3], [:])
+    :
+    ARG_IF_FALSE
   fi
 ])
 
@@ -945,14 +971,14 @@
     *)
       ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
   esac
-  FLAGS_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""])
+  FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$ZERO_ARCHFLAG], IF_FALSE: [ZERO_ARCHFLAG=""])
   AC_SUBST(ZERO_ARCHFLAG)
 
   # Check that the compiler supports -mX (or -qX on AIX) flags
   # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
-  FLAGS_COMPILER_CHECK_ARGUMENTS([${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
-      [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
-      [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
+  FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
+      IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
+      IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
   AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
 
   AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
@@ -993,9 +1019,9 @@
       ;;
     gcc)
       # Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
-      FLAGS_COMPILER_CHECK_ARGUMENTS([-Wno-this-is-a-warning-that-do-not-exist],
-          [GCC_CAN_DISABLE_WARNINGS=true],
-          [GCC_CAN_DISABLE_WARNINGS=false]
+      FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
+          IF_TRUE: [GCC_CAN_DISABLE_WARNINGS=true],
+          IF_FALSE: [GCC_CAN_DISABLE_WARNINGS=false]
       )
       if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
         DISABLE_WARNING_PREFIX="-Wno-"
@@ -1006,9 +1032,9 @@
       # Repeate the check for the BUILD_CC
       CC_OLD="$CC"
       CC="$BUILD_CC"
-      FLAGS_COMPILER_CHECK_ARGUMENTS([-Wno-this-is-a-warning-that-do-not-exist],
-          [BUILD_CC_CAN_DISABLE_WARNINGS=true],
-          [BUILD_CC_CAN_DISABLE_WARNINGS=false]
+      FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
+          IF_TRUE: [BUILD_CC_CAN_DISABLE_WARNINGS=true],
+          IF_FALSE: [BUILD_CC_CAN_DISABLE_WARNINGS=false]
       )
       if test "x$BUILD_CC_CAN_DISABLE_WARNINGS" = "xtrue"; then
         BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
--- a/common/autoconf/generated-configure.sh	Thu Jan 14 14:34:36 2016 +0100
+++ b/common/autoconf/generated-configure.sh	Fri Jan 15 09:15:33 2016 +0100
@@ -3451,6 +3451,31 @@
 # questions.
 #
 
+# Create a function/macro that takes a series of named arguments. The call is
+# similar to AC_DEFUN, but the setup of the function looks like this:
+# BASIC_DEFUN_NAMED([MYFUNC], [FOO *BAR], [$@], [
+# ... do something
+#   AC_MSG_NOTICE([Value of BAR is ARG_BAR])
+# ])
+# A star (*) in front of a named argument means that it is required and it's
+# presence will be verified. To pass e.g. the first value as a normal indexed
+# argument, use [m4_shift($@)] as the third argument instead of [$@]. These
+# arguments are referenced in the function by their name prefixed by ARG_, e.g.
+# "ARG_FOO".
+#
+# The generated function can be called like this:
+# MYFUNC(FOO: [foo-val], BAR:
+#     [
+#         $ECHO hello world
+#     ])
+#
+#
+# Argument 1: Name of the function to define
+# Argument 2: List of legal named arguments, with a * prefix for required arguments
+# Argument 3: Argument array to treat as named, typically $@
+# Argument 4: The main function body
+
+
 # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
 # If so, then append $1 to $2 \
 # Also set JVM_ARG_OK to true/false depending on outcome.
@@ -3794,6 +3819,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
 #
 
@@ -3877,20 +3911,24 @@
 
 
 
-# FLAGS_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                   [RUN-IF-FALSE])
+# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
+#                                   IF_FALSE: [RUN-IF-FALSE])
 # ------------------------------------------------------------
 # Check that the c and c++ compilers support an argument
 
 
-# FLAGS_LINKER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                    [RUN-IF-FALSE])
+
+
+# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
+#                                   IF_FALSE: [RUN-IF-FALSE])
 # ------------------------------------------------------------
 # Check that the linker support an argument
 
 
 
 
+
+
 #
 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -4308,7 +4346,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 +4839,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=1452780299
 
 ###############################################################################
 #
@@ -45349,6 +45387,54 @@
     # "-Og" suppported for GCC 4.8 and later
     CFLAG_OPTIMIZE_DEBUG_FLAG="-Og"
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$CFLAG_OPTIMIZE_DEBUG_FLAG\"" >&5
 $as_echo_n "checking if compiler supports \"$CFLAG_OPTIMIZE_DEBUG_FLAG\"... " >&6; }
   supports=yes
@@ -45408,15 +45494,76 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
+    :
     HAS_CFLAG_OPTIMIZE_DEBUG=true
   else
+    :
     HAS_CFLAG_OPTIMIZE_DEBUG=false
   fi
 
 
+
+
+
+
+
+
+
+
+
+
+
     # "-z relro" supported in GNU binutils 2.17 and later
     LINKER_RELRO_FLAG="-Wl,-z,relro"
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if linker supports \"$LINKER_RELRO_FLAG\"" >&5
 $as_echo_n "checking if linker supports \"$LINKER_RELRO_FLAG\"... " >&6; }
   supports=yes
@@ -45458,15 +45605,76 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
+    :
     HAS_LINKER_RELRO=true
   else
+    :
     HAS_LINKER_RELRO=false
   fi
 
 
+
+
+
+
+
+
+
+
+
+
+
     # "-z now" supported in GNU binutils 2.11 and later
     LINKER_NOW_FLAG="-Wl,-z,now"
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if linker supports \"$LINKER_NOW_FLAG\"" >&5
 $as_echo_n "checking if linker supports \"$LINKER_NOW_FLAG\"... " >&6; }
   supports=yes
@@ -45508,11 +45716,24 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
+    :
     HAS_LINKER_NOW=true
   else
+    :
     HAS_LINKER_NOW=false
   fi
 
+
+
+
+
+
+
+
+
+
+
+
   fi
 
   # Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed
@@ -45930,6 +46151,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
 
 
@@ -46810,6 +47054,49 @@
       # Not all versions of gcc support -fstack-protector
       STACK_PROTECTOR_CFLAG="-fstack-protector-all"
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$STACK_PROTECTOR_CFLAG\"" >&5
 $as_echo_n "checking if compiler supports \"$STACK_PROTECTOR_CFLAG\"... " >&6; }
   supports=yes
@@ -46870,11 +47157,24 @@
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
     :
-  else
+
+  else
+    :
     STACK_PROTECTOR_CFLAG=""
   fi
 
 
+
+
+
+
+
+
+
+
+
+
+
       CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
       CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
       ;;
@@ -47352,6 +47652,49 @@
       ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
   esac
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$ZERO_ARCHFLAG\"" >&5
 $as_echo_n "checking if compiler supports \"$ZERO_ARCHFLAG\"... " >&6; }
   supports=yes
@@ -47412,15 +47755,76 @@
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
     :
-  else
+
+  else
+    :
     ZERO_ARCHFLAG=""
   fi
 
 
 
+
+
+
+
+
+
+
+
+
+
+
   # Check that the compiler supports -mX (or -qX on AIX) flags
   # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"" >&5
 $as_echo_n "checking if compiler supports \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"... " >&6; }
   supports=yes
@@ -47480,13 +47884,26 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
+    :
     COMPILER_SUPPORTS_TARGET_BITS_FLAG=true
   else
+    :
     COMPILER_SUPPORTS_TARGET_BITS_FLAG=false
   fi
 
 
 
+
+
+
+
+
+
+
+
+
+
+
   # Check whether --enable-warnings-as-errors was given.
 if test "${enable_warnings_as_errors+set}" = set; then :
   enableval=$enable_warnings_as_errors;
@@ -47533,6 +47950,54 @@
     gcc)
       # Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"" >&5
 $as_echo_n "checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"... " >&6; }
   supports=yes
@@ -47592,12 +48057,25 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
+    :
     GCC_CAN_DISABLE_WARNINGS=true
   else
+    :
     GCC_CAN_DISABLE_WARNINGS=false
 
   fi
 
+
+
+
+
+
+
+
+
+
+
+
       if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
         DISABLE_WARNING_PREFIX="-Wno-"
       else
@@ -47608,6 +48086,54 @@
       CC_OLD="$CC"
       CC="$BUILD_CC"
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"" >&5
 $as_echo_n "checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"... " >&6; }
   supports=yes
@@ -47667,12 +48193,25 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
+    :
     BUILD_CC_CAN_DISABLE_WARNINGS=true
   else
+    :
     BUILD_CC_CAN_DISABLE_WARNINGS=false
 
   fi
 
+
+
+
+
+
+
+
+
+
+
+
       if test "x$BUILD_CC_CAN_DISABLE_WARNINGS" = "xtrue"; then
         BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
       else
@@ -51742,12 +52281,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 +60098,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 +60322,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 +60340,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} \
@@ -61428,7 +62030,6 @@
 
   # Move configure.log from current directory to the build output root
   if test -e ./configure.log; then
-    echo found it
     $MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
   fi
 
--- a/common/autoconf/lib-cups.m4	Thu Jan 14 14:34:36 2016 +0100
+++ b/common/autoconf/lib-cups.m4	Fri Jan 15 09:15:33 2016 +0100
@@ -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/common/autoconf/toolchain.m4	Thu Jan 14 14:34:36 2016 +0100
+++ b/common/autoconf/toolchain.m4	Fri Jan 15 09:15:33 2016 +0100
@@ -75,8 +75,8 @@
       # For full static builds, we're overloading the SHARED_LIBRARY
       # variables in order to limit the amount of changes required.
       # It would be better to remove SHARED and just use LIBRARY and
-      # LIBRARY_SUFFIX for libraries that can be built either 
-      # shared or static and use STATIC_* for libraries that are 
+      # LIBRARY_SUFFIX for libraries that can be built either
+      # shared or static and use STATIC_* for libraries that are
       # always built statically.
       if test "x$STATIC_BUILD" = xtrue; then
         SHARED_LIBRARY='lib[$]1.a'
@@ -824,21 +824,21 @@
 
     # "-Og" suppported for GCC 4.8 and later
     CFLAG_OPTIMIZE_DEBUG_FLAG="-Og"
-    FLAGS_COMPILER_CHECK_ARGUMENTS([$CFLAG_OPTIMIZE_DEBUG_FLAG],
-      [HAS_CFLAG_OPTIMIZE_DEBUG=true],
-      [HAS_CFLAG_OPTIMIZE_DEBUG=false])
+    FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$CFLAG_OPTIMIZE_DEBUG_FLAG],
+      IF_TRUE: [HAS_CFLAG_OPTIMIZE_DEBUG=true],
+      IF_FALSE: [HAS_CFLAG_OPTIMIZE_DEBUG=false])
 
     # "-z relro" supported in GNU binutils 2.17 and later
     LINKER_RELRO_FLAG="-Wl,-z,relro"
-    FLAGS_LINKER_CHECK_ARGUMENTS([$LINKER_RELRO_FLAG],
-      [HAS_LINKER_RELRO=true],
-      [HAS_LINKER_RELRO=false])
+    FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$LINKER_RELRO_FLAG],
+      IF_TRUE: [HAS_LINKER_RELRO=true],
+      IF_FALSE: [HAS_LINKER_RELRO=false])
 
     # "-z now" supported in GNU binutils 2.11 and later
     LINKER_NOW_FLAG="-Wl,-z,now"
-    FLAGS_LINKER_CHECK_ARGUMENTS([$LINKER_NOW_FLAG],
-      [HAS_LINKER_NOW=true],
-      [HAS_LINKER_NOW=false])
+    FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$LINKER_NOW_FLAG],
+      IF_TRUE: [HAS_LINKER_NOW=true],
+      IF_FALSE: [HAS_LINKER_NOW=false])
   fi
 
   # Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed
--- a/corba/.hgtags	Thu Jan 14 14:34:36 2016 +0100
+++ b/corba/.hgtags	Fri Jan 15 09:15:33 2016 +0100
@@ -342,3 +342,5 @@
 10a482b863582376d4ca229090334b23b05159fc jdk-9+97
 ea285530245cf4e0edf0479121a41347d3030eba jdk-9+98
 180212ee1d8710691ba9944593dfc1ff3e4f1532 jdk-9+99
+791d0d3ac0138faeb6110bd840a4545bc1950df2 jdk-9+100
+30dfb3bd3d06b4bb80a087babc0d1841edba187b jdk-9+101
--- a/hotspot/.hgtags	Thu Jan 14 14:34:36 2016 +0100
+++ b/hotspot/.hgtags	Fri Jan 15 09:15:33 2016 +0100
@@ -502,3 +502,5 @@
 de592ea5f7ba0f8a8c5afc03bd169f7690c72b6f jdk-9+97
 e5b1a23be1e105417ba1c4c576ab373eb3fa2c2b jdk-9+98
 f008e8cc10d5b3212fb22d58c96fa01d38654f19 jdk-9+99
+bdb0acafc63c42e84d9d8195bf2e2b25ee9c3306 jdk-9+100
+9f45d3d57d6948cf526fbc2e2891a9a74ac6941a jdk-9+101
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Fri Jan 15 09:15:33 2016 +0100
@@ -49,7 +49,7 @@
 import jdk.vm.ci.runtime.JVMCIBackend;
 import jdk.vm.ci.runtime.JVMCICompiler;
 import jdk.vm.ci.services.Services;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 //JaCoCo Exclude
 
--- a/hotspot/src/share/vm/prims/jvm.cpp	Thu Jan 14 14:34:36 2016 +0100
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Fri Jan 15 09:15:33 2016 +0100
@@ -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/hotspot/src/share/vm/prims/nativeLookup.cpp	Thu Jan 14 14:34:36 2016 +0100
+++ b/hotspot/src/share/vm/prims/nativeLookup.cpp	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -125,7 +125,7 @@
   { CC"Java_jdk_internal_misc_Unsafe_registerNatives",             NULL, FN_PTR(JVM_RegisterJDKInternalMiscUnsafeMethods) },
   { CC"Java_sun_misc_Unsafe_registerNatives",                      NULL, FN_PTR(JVM_RegisterSunMiscUnsafeMethods)         },
   { CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
-  { CC"Java_sun_misc_Perf_registerNatives",                        NULL, FN_PTR(JVM_RegisterPerfMethods)         },
+  { CC"Java_jdk_internal_perf_Perf_registerNatives",               NULL, FN_PTR(JVM_RegisterPerfMethods)         },
   { CC"Java_sun_hotspot_WhiteBox_registerNatives",                 NULL, FN_PTR(JVM_RegisterWhiteBoxMethods)     },
 #if INCLUDE_JVMCI
   { CC"Java_jdk_vm_ci_runtime_JVMCI_initializeRuntime",            NULL, FN_PTR(JVM_GetJVMCIRuntime)             },
--- a/hotspot/src/share/vm/prims/perf.cpp	Thu Jan 14 14:34:36 2016 +0100
+++ b/hotspot/src/share/vm/prims/perf.cpp	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, 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
@@ -34,7 +34,7 @@
 #include "runtime/perfMemory.hpp"
 
 /*
- *      Implementation of class sun.misc.Perf
+ *      Implementation of class jdk.internal.perf.Perf
  */
 
 
--- a/jaxp/.hgtags	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/.hgtags	Fri Jan 15 09:15:33 2016 +0100
@@ -342,3 +342,5 @@
 9c107c050335d7ee63b2a8b38ca5d498f19713a2 jdk-9+97
 52b01339235f24c93b679bd6b8fb36a1072ad0ac jdk-9+98
 52774b544850c791f1d1c67db2601b33739b18c9 jdk-9+99
+d45bcd374f6057851e3c2dcd45607cd362afadfa jdk-9+100
+d3e834ff74e724a2b92a558e18e8cbf81c6dbc59 jdk-9+101
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java	Fri Jan 15 09:15:33 2016 +0100
@@ -32,7 +32,6 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
@@ -43,6 +42,7 @@
 import static javax.xml.catalog.BaseEntry.CatalogEntryType;
 import static javax.xml.catalog.CatalogFeatures.DEFER_TRUE;
 import javax.xml.catalog.CatalogFeatures.Feature;
+import static javax.xml.catalog.CatalogMessages.formatMessage;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
@@ -109,25 +109,20 @@
      */
     public CatalogImpl(CatalogImpl parent, CatalogFeatures f, String... file) throws CatalogException {
         super(CatalogEntryType.CATALOG);
-        this.parent = parent;
-        if (parent == null) {
-            level = 0;
-        } else {
-            level = parent.level + 1;
+        if (f == null) {
+            throw new NullPointerException(
+                    formatMessage(CatalogMessages.ERR_NULL_ARGUMENT, new Object[]{"CatalogFeatures"}));
         }
-        if (f == null) {
-            this.features = CatalogFeatures.defaults();
-        } else {
-            this.features = f;
+
+        if (file.length > 0) {
+            CatalogMessages.reportNPEOnNull("The path to the catalog file", file[0]);
         }
-        setPrefer(features.get(Feature.PREFER));
-        setDeferred(features.get(Feature.DEFER));
-        setResolve(features.get(Feature.RESOLVE));
+
+        init(parent, f);
 
         //Path of catalog files
         String[] catalogFile = file;
-        if (level == 0
-                && (file == null || (file.length == 0 || file[0] == null))) {
+        if (level == 0 && file.length == 0) {
             String files = features.get(Feature.FILES);
             if (files != null) {
                 catalogFile = files.split(";[ ]*");
@@ -166,6 +161,23 @@
         }
     }
 
+    private void init(CatalogImpl parent, CatalogFeatures f) {
+        this.parent = parent;
+        if (parent == null) {
+            level = 0;
+        } else {
+            level = parent.level + 1;
+        }
+        if (f == null) {
+            this.features = CatalogFeatures.defaults();
+        } else {
+            this.features = f;
+        }
+        setPrefer(features.get(Feature.PREFER));
+        setDeferred(features.get(Feature.DEFER));
+        setResolve(features.get(Feature.RESOLVE));
+    }
+
     /**
      * Resets the Catalog instance to its initial state.
      */
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java	Fri Jan 15 09:15:33 2016 +0100
@@ -38,33 +38,38 @@
     }
 
     /**
-     * Creates a Catalog object using the specified feature settings and path to
-     * a catalog file. If the features is null, the default features will be used.
-     * If the path is empty, System property {@code javax.xml.catalog.files} will
-     * be read to locate the initial list of catalog files.
+     * Creates a {@code Catalog} object using the specified feature settings and
+     * path to one or more catalog files.
      * <p>
-     * If more than one catalog files are specified through the path argument or
+     * If {@code paths} is empty, system property {@code javax.xml.catalog.files}
+     * will be read to locate the initial list of catalog files.
+     * <p>
+     * If more than one catalog files are specified through the paths argument or
      * {@code javax.xml.catalog.files} property, the first entry is considered
      * the main catalog, while others are treated as alternative catalogs after
      * those referenced by the {@code nextCatalog} elements in the main catalog.
+     * <p>
+     * As specified in
+     * <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.res.fail">
+     * XML Catalogs, OASIS Standard V1.1</a>, invalid path entries will be ignored.
+     * No error will be reported. In case all entries are invalid, the resolver
+     * will return as no mapping is found.
      *
      * @param features the catalog features
-     * @param path path(s) to one or more catalogs.
+     * @param paths path(s) to one or more catalogs.
      *
-     * @return a catalog instance
-     * @throws CatalogException If no catalog can be found whether through the
-     * specified path or the System property {@code javax.xml.catalog.files}, or
-     * an error occurs while parsing the catalog
+     * @return an instance of a {@code Catalog}
+     * @throws CatalogException If an error occurs while parsing the catalog
      */
-    public static Catalog catalog(CatalogFeatures features, String... path) {
-        return new CatalogImpl(features, path);
+    public static Catalog catalog(CatalogFeatures features, String... paths) {
+        return new CatalogImpl(features, paths);
     }
 
     /**
-     * Creates an instance of a CatalogResolver using the specified catalog.
+     * Creates an instance of a {@code CatalogResolver} using the specified catalog.
      *
      * @param catalog the catalog instance
-     * @return an instance of a CatalogResolver
+     * @return an instance of a {@code CatalogResolver}
      */
     public static CatalogResolver catalogResolver(Catalog catalog) {
         if (catalog == null) CatalogMessages.reportNPEOnNull("catalog", null);
@@ -72,10 +77,10 @@
     }
 
     /**
-     * Creates an instance of a CatalogUriResolver using the specified catalog.
+     * Creates an instance of a {@code CatalogUriResolver} using the specified catalog.
      *
      * @param catalog the catalog instance
-     * @return an instance of a CatalogResolver
+     * @return an instance of a {@code CatalogResolver}
      */
     public static CatalogUriResolver catalogUriResolver(Catalog catalog) {
         if (catalog == null) CatalogMessages.reportNPEOnNull("catalog", null);
@@ -83,50 +88,60 @@
     }
 
     /**
-     * Creates an instance of a CatalogResolver using the specified feature settings
-     * and path to a catalog file. If the features is null, the default features will
-     * be used. If the path is empty, System property {@code javax.xml.catalog.files}
+     * Creates an instance of a {@code CatalogResolver} using the specified feature
+     * settings and path to one or more catalog files.
+     * <p>
+     * If {@code paths} is empty, system property {@code javax.xml.catalog.files}
      * will be read to locate the initial list of catalog files.
      * <p>
-     * If more than one catalog files are specified through the path argument or
+     * If more than one catalog files are specified through the paths argument or
      * {@code javax.xml.catalog.files} property, the first entry is considered
      * the main catalog, while others are treated as alternative catalogs after
      * those referenced by the {@code nextCatalog} elements in the main catalog.
+     * <p>
+     * As specified in
+     * <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.res.fail">
+     * XML Catalogs, OASIS Standard V1.1</a>, invalid path entries will be ignored.
+     * No error will be reported. In case all entries are invalid, the resolver
+     * will return as no mapping is found.
      *
      * @param features the catalog features
-     * @param path the path(s) to one or more catalogs
+     * @param paths the path(s) to one or more catalogs
      *
-     * @return an instance of a CatalogResolver
-     * @throws CatalogException If no catalog can be found whether through the
-     * specified path or the System property {@code javax.xml.catalog.files}, or
-     * an error occurs while parsing the catalog
+     * @return an instance of a {@code CatalogResolver}
+     * @throws CatalogException If an error occurs while parsing the catalog
      */
-    public static CatalogResolver catalogResolver(CatalogFeatures features, String... path) {
-        Catalog catalog = catalog(features, path);
+    public static CatalogResolver catalogResolver(CatalogFeatures features, String... paths) {
+        Catalog catalog = catalog(features, paths);
         return new CatalogResolverImpl(catalog);
     }
 
     /**
-     * Creates an instance of a CatalogUriResolver using the specified feature settings
-     * and path to a catalog file. If the features is null, the default features will
-     * be used. If the path is empty, System property {@code javax.xml.catalog.files}
+     * Creates an instance of a {@code CatalogUriResolver} using the specified
+     * feature settings and path to one or more catalog files.
+     * <p>
+     * If {@code paths} is empty, system property {@code javax.xml.catalog.files}
      * will be read to locate the initial list of catalog files.
      * <p>
-     * If more than one catalog files are specified through the path argument or
+     * If more than one catalog files are specified through the paths argument or
      * {@code javax.xml.catalog.files} property, the first entry is considered
      * the main catalog, while others are treated as alternative catalogs after
      * those referenced by the {@code nextCatalog} elements in the main catalog.
+     * <p>
+     * As specified in
+     * <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.res.fail">
+     * XML Catalogs, OASIS Standard V1.1</a>, invalid path entries will be ignored.
+     * No error will be reported. In case all entries are invalid, the resolver
+     * will return as no mapping is found.
      *
      * @param features the catalog features
-     * @param path the path(s) to one or more catalogs
+     * @param paths the path(s) to one or more catalogs
      *
-     * @return an instance of a CatalogResolver
-     * @throws CatalogException If no catalog can be found whether through the
-     * specified path or the System property {@code javax.xml.catalog.files}, or
-     * an error occurs while parsing the catalog
+     * @return an instance of a {@code CatalogUriResolver}
+     * @throws CatalogException If an error occurs while parsing the catalog
      */
-    public static CatalogUriResolver catalogUriResolver(CatalogFeatures features, String... path) {
-        Catalog catalog = catalog(features, path);
+    public static CatalogUriResolver catalogUriResolver(CatalogFeatures features, String... paths) {
+        Catalog catalog = catalog(features, paths);
         return new CatalogUriResolverImpl(catalog);
     }
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogUriResolver.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogUriResolver.java	Fri Jan 15 09:15:33 2016 +0100
@@ -43,9 +43,9 @@
      * absolute if the absolute URI is required
      *
      * @return a {@link javax.xml.transform.Source} object if a mapping is found.
-     * If no mapping is found, returns a {@link javax.xml.transform.Source} object
-     * containing an empty {@link java.io.Reader} if the
-     * {@code javax.xml.catalog.resolve} property is set to {@code ignore};
+     * If no mapping is found, returns an empty {@link javax.xml.transform.Source}
+     * object if the {@code javax.xml.catalog.resolve} property is set to
+     * {@code ignore};
      * returns a {@link javax.xml.transform.Source} object with the original URI
      * (href, or href resolved with base if base is not null) if the
      * {@code javax.xml.catalog.resolve} property is set to {@code continue}.
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteSystem.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteSystem.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -72,6 +72,7 @@
     public String getSystemIdStartString () {
         return systemIdStartString;
     }
+
     /**
      * Get the rewritePrefix attribute.
      * @return The rewritePrefix attribute value.
@@ -80,7 +81,6 @@
         return rewritePrefix;
     }
 
-
     /**
      * Try to match the specified systemId with the entry. Return the match if it
      * is successful and the length of the systemIdStartString is longer than the
@@ -91,14 +91,20 @@
      * @return The replacement URI if the match is successful, null if not.
      */
     public String match(String systemId, int currentMatch) {
-        if (systemIdStartString.length() <= systemId.length() &&
+        if (systemIdStartString.length() < systemId.length() &&
                 systemIdStartString.equals(systemId.substring(0, systemIdStartString.length()))) {
             if (currentMatch < systemIdStartString.length()) {
                 String prefix = rewritePrefix.toExternalForm();
-                if (!prefix.endsWith(SLASH) && !systemId.startsWith(SLASH)) {
-                    return prefix + SLASH + systemId.substring(systemIdStartString.length());
+                String sysId;
+                if (systemIdStartString.endsWith(SLASH)) {
+                    sysId = systemId.substring(systemIdStartString.length());
                 } else {
-                    return prefix + systemId.substring(systemIdStartString.length());
+                    sysId = systemId.substring(systemIdStartString.length() + 1);
+                }
+                if (prefix.endsWith(SLASH)) {
+                    return prefix + sysId;
+                } else {
+                    return prefix + SLASH + sysId;
                 }
             }
         }
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteUri.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteUri.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -72,6 +72,7 @@
     public String getURIStartString () {
         return uriStartString;
     }
+
     /**
      * Get the rewritePrefix attribute.
      * @return The rewritePrefix attribute value.
@@ -91,14 +92,20 @@
      */
     @Override
     public String match(String systemId, int currentMatch) {
-        if (uriStartString.length() <= systemId.length() &&
+        if (uriStartString.length() < systemId.length() &&
                 uriStartString.equals(systemId.substring(0, uriStartString.length()))) {
             if (currentMatch < uriStartString.length()) {
                 String prefix = rewritePrefix.toExternalForm();
-                if (!prefix.endsWith(SLASH) && !systemId.startsWith(SLASH)) {
-                    return prefix + SLASH + systemId.substring(uriStartString.length());
+                String sysId;
+                if (uriStartString.endsWith(SLASH)) {
+                    sysId = systemId.substring(uriStartString.length());
                 } else {
-                    return prefix + systemId.substring(uriStartString.length());
+                    sysId = systemId.substring(uriStartString.length() + 1);
+                }
+                if (prefix.endsWith(SLASH)) {
+                    return prefix + sysId;
+                } else {
+                    return prefix + SLASH + sysId;
                 }
             }
         }
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/Source.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/Source.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -52,4 +52,17 @@
      * if setSystemId was not called.
      */
     public String getSystemId();
+
+    /**
+     * Indicates whether the {@code Source} object is empty. Empty means
+     * that there is no input available from this Source.
+     *
+     * @implSpec The default implementation of this method throws
+     * {@link UnsupportedOperationException}.
+     *
+     * @return true if the {@code Source} object is empty, false otherwise
+     */
+    default boolean isEmpty() {
+        throw new UnsupportedOperationException("The isEmpty method is not supported.");
+    }
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/DOMSource.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/DOMSource.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -122,6 +122,7 @@
      *
      * @param systemID Base URL for this DOM tree.
      */
+    @Override
     public void setSystemId(String systemID) {
         this.systemID = systemID;
     }
@@ -132,7 +133,25 @@
      *
      * @return Base URL for this DOM tree.
      */
+    @Override
     public String getSystemId() {
         return this.systemID;
     }
+
+    /**
+     * Indicates whether the {@code DOMSource} object is empty. Empty is
+     * defined as follows:
+     * <ul>
+     * <li>if the system identifier and node are {@code null};
+     * </li>
+     * <li>if the system identifier is null, and the {@code node} has no child nodes.
+     * </li>
+     * </ul>
+     *
+     * @return true if the {@code DOMSource} object is empty, false otherwise
+     */
+    @Override
+    public boolean isEmpty() {
+        return systemID == null && (node == null || !node.hasChildNodes());
+    }
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/sax/SAXSource.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/sax/SAXSource.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -147,6 +147,7 @@
      *
      * @param systemId The system identifier as a URI string.
      */
+    @Override
     public void setSystemId(String systemId) {
 
         if (null == inputSource) {
@@ -162,6 +163,7 @@
      *
      * @return Base URL for the <code>Source</code>, or <code>null</code>.
      */
+    @Override
     public String getSystemId() {
 
         if (inputSource == null) {
@@ -207,4 +209,22 @@
             return null;
         }
     }
+
+    /**
+     * Indicates whether the {@code SAXSource} object is empty. Empty is
+     * defined as follows:
+     * <ul>
+     * <li>if the system identifier and {@code InputSource} are {@code null};
+     * </li>
+     * <li>if the system identifier is {@code null}, and the {@code InputSource}
+     * is empty.
+     * </li>
+     * </ul>
+     *
+     * @return true if the {@code SAXSource} object is empty, false otherwise
+     */
+    @Override
+    public boolean isEmpty() {
+        return getSystemId() == null && (inputSource == null || inputSource.isEmpty());
+    }
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/StAXSource.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/StAXSource.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -209,6 +209,7 @@
      * @throws UnsupportedOperationException Is <strong>always</strong>
      *   thrown by this method.
      */
+    @Override
     public void setSystemId(final String systemId) {
 
         throw new UnsupportedOperationException(
@@ -229,8 +230,21 @@
      *
      * @return System identifier used by this <code>StAXSource</code>.
      */
+    @Override
     public String getSystemId() {
 
         return systemId;
     }
+
+    /**
+     * Indicates whether the {@code StAXSource} object is empty. Since a
+     * {@code StAXSource} object can never be empty, this method always returns
+     * false.
+     *
+     * @return unconditionally false
+     */
+    @Override
+    public boolean isEmpty() {
+        return false;
+    }
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/StreamSource.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/StreamSource.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -26,8 +26,10 @@
 package javax.xml.transform.stream;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
+import javax.xml.transform.Result;
 
 import javax.xml.transform.Source;
 
@@ -233,6 +235,7 @@
      *
      * @param systemId The system identifier as a URL string.
      */
+    @Override
     public void setSystemId(String systemId) {
         this.systemId = systemId;
     }
@@ -243,6 +246,7 @@
      * @return The system identifier that was set with setSystemId, or null
      * if setSystemId was not called.
      */
+    @Override
     public String getSystemId() {
         return systemId;
     }
@@ -259,6 +263,59 @@
         this.systemId = f.toURI().toASCIIString();
     }
 
+    /**
+     * Indicates whether the {@code StreamSource} object is empty. Empty is
+     * defined as follows:
+     * <ul>
+     * <li>All of the input sources, including the public identifier, system
+     * identifier, byte stream, and character stream, are {@code null}.
+     * </li>
+     * <li>The public identifier and system identifier are {@code null}, and
+     * byte and character stream are either {@code null} or contain no byte or
+     * character.
+     * <p>
+     * Note that this method will reset the byte stream if it is provided, or
+     * the character stream if the byte stream is not provided.
+     * </li>
+     * </ul>
+     * <p>
+     * In case of error while checking the byte or character stream, the method
+     * will return false to allow the XML processor to handle the error.
+     *
+     * @return true if the {@code StreamSource} object is empty, false otherwise
+     */
+    @Override
+    public boolean isEmpty() {
+        return (publicId == null && systemId == null && isStreamEmpty());
+    }
+
+    private boolean isStreamEmpty() {
+        boolean empty = true;
+        try {
+            if (inputStream != null) {
+                inputStream.reset();
+                int bytesRead = inputStream.available();
+                if (bytesRead > 0) {
+                    return false;
+                }
+            }
+
+            if (reader != null) {
+                reader.reset();
+                int c = reader.read();
+                reader.reset();
+                if (c != -1) {
+                    return false;
+                }
+            }
+        } catch (IOException ex) {
+            //in case of error, return false
+            return false;
+        }
+
+        return empty;
+    }
+
     //////////////////////////////////////////////////////////////////////
     // Internal state.
     //////////////////////////////////////////////////////////////////////
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/InputSource.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/InputSource.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -30,6 +30,7 @@
 
 package org.xml.sax;
 
+import java.io.IOException;
 import java.io.Reader;
 import java.io.InputStream;
 
@@ -343,8 +344,57 @@
         return characterStream;
     }
 
+    /**
+     * Indicates whether the {@code InputSource} object is empty. Empty is
+     * defined as follows:
+     * <ul>
+     * <li>All of the input sources, including the public identifier, system
+     * identifier, byte stream, and character stream, are {@code null}.
+     * </li>
+     * <li>The public identifier and system identifier are  {@code null}, and
+     * byte and character stream are either  {@code null} or contain no byte
+     * or character.
+     * <p>
+     * Note that this method will reset the byte stream if it is provided, or
+     * the character stream if the byte stream is not provided.
+     * </li>
+     * </ul>
+     * <p>
+     * In case of error while checking the byte or character stream, the method
+     * will return false to allow the XML processor to handle the error.
+     *
+     * @return true if the {@code InputSource} object is empty, false otherwise
+     */
+    public boolean isEmpty() {
+        return (publicId == null && systemId == null && isStreamEmpty());
+    }
 
+    private boolean isStreamEmpty() {
+        boolean empty = true;
+        try {
+            if (byteStream != null) {
+                byteStream.reset();
+                int bytesRead = byteStream.available();
+                if (bytesRead > 0) {
+                    return false;
+                }
+            }
 
+            if (characterStream != null) {
+                characterStream.reset();
+                int c = characterStream.read();
+                characterStream.reset();
+                if (c != -1) {
+                    return false;
+                }
+            }
+        } catch (IOException ex) {
+            //in case of error, return false
+            return false;
+        }
+
+        return empty;
+    }
     ////////////////////////////////////////////////////////////////////
     // Internal state.
     ////////////////////////////////////////////////////////////////////
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java	Fri Jan 15 09:15:33 2016 +0100
@@ -56,23 +56,14 @@
 
     @DataProvider(name = "catalog-countOfLoadedCatalogFile")
     private Object[][] data() {
-        return new Object[][] {
-                // This catalog specifies null catalog explicitly,
-                // and the count of loaded catalogs should be 0.
-                { createCatalog(null), 0 },
-
-                // This catalog specifies null catalog implicitly,
-                // and the count of loaded catalogs should be 0.
-                { createCatalog(CatalogFeatures.defaults()), 0 },
-
-                // This catalog loads null catalog with true DEFER,
-                // and the count of loaded catalogs should be 0.
-                { createCatalog(createDeferFeature(DEFER_TRUE)), 0 },
-
-                // This catalog loads null catalog with false DEFER.
-                // It should load all of none-current catalogs and the
-                // count of loaded catalogs should be 3.
-                { createCatalog(createDeferFeature(DEFER_FALSE)), 3 } };
+        return new Object[][]{
+            // By default, alternative catalogs are not loaded.
+            {createCatalog(CatalogFeatures.defaults()), 0},
+            // Alternative catalogs are not loaded when DEFER is set to true.
+            {createCatalog(createDeferFeature(DEFER_TRUE)), 0},
+            // The 3 alternative catalogs are not pre-loaded
+            //when DEFER is set to false.
+            {createCatalog(createDeferFeature(DEFER_FALSE)), 3}};
     }
 
     private CatalogFeatures createDeferFeature(String defer) {
--- a/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java	Fri Jan 15 09:15:33 2016 +0100
@@ -83,7 +83,7 @@
      * Creates CatalogResolver with a set of catalogs.
      */
     static CatalogResolver catalogResolver(String... catalogName) {
-        return catalogResolver(null, catalogName);
+        return catalogResolver(CatalogFeatures.defaults(), catalogName);
     }
 
     /*
@@ -91,15 +91,16 @@
      */
     static CatalogResolver catalogResolver(CatalogFeatures features,
             String... catalogName) {
-        return CatalogManager.catalogResolver(features,
-                getCatalogPaths(catalogName));
+        return (catalogName == null) ?
+                CatalogManager.catalogResolver(features) :
+                CatalogManager.catalogResolver(features, getCatalogPaths(catalogName));
     }
 
     /*
      * Creates catalogUriResolver with a set of catalogs.
      */
     static CatalogUriResolver catalogUriResolver(String... catalogName) {
-        return catalogUriResolver(null, catalogName);
+        return catalogUriResolver(CatalogFeatures.defaults(), catalogName);
     }
 
     /*
@@ -107,8 +108,9 @@
      */
     static CatalogUriResolver catalogUriResolver(
             CatalogFeatures features, String... catalogName) {
-        return CatalogManager.catalogUriResolver(features,
-                getCatalogPaths(catalogName));
+        return (catalogName == null) ?
+                CatalogManager.catalogUriResolver(features) :
+                CatalogManager.catalogUriResolver(features, getCatalogPaths(catalogName));
     }
 
     // Gets the paths of the specified catalogs.
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java	Fri Jan 15 09:15:33 2016 +0100
@@ -89,7 +89,7 @@
     /**
      * BOM table for storing BOM header.
      */
-    private final static Map<String, byte[]> bom = new HashMap();
+    private final static Map<String, byte[]> bom = new HashMap<>();
 
     /**
      * Initialize all BOM headers.
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -27,14 +27,13 @@
 import javax.xml.catalog.CatalogFeatures.Feature;
 import javax.xml.catalog.CatalogManager;
 import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import static jaxp.library.JAXPTestUtilities.getPathByClassName;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
-import org.w3c.dom.Element;
 import org.xml.sax.Attributes;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
@@ -42,12 +41,66 @@
 import org.xml.sax.ext.DefaultHandler2;
 
 /*
- * @bug 8081248
+ * @bug 8081248, 8144966, 8146606
  * @summary Tests basic Catalog functions.
  */
 
 public class CatalogTest {
     /*
+       @bug 8146606
+       Verifies that the resulting systemId does not contain duplicate slashes
+    */
+    public void testRewriteSystem() {
+        String catalog = getClass().getResource("rewriteCatalog.xml").getFile();
+
+        try {
+            CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalog);
+            String actualSystemId = resolver.resolveEntity(null, "http://remote.com/dtd/book.dtd").getSystemId();
+            Assert.assertTrue(!actualSystemId.contains("//"), "result contains duplicate slashes");
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+    }
+
+    /*
+       @bug 8146606
+       Verifies that the resulting systemId does not contain duplicate slashes
+    */
+    public void testRewriteUri() {
+        String catalog = getClass().getResource("rewriteCatalog.xml").getFile();
+
+        try {
+
+            CatalogUriResolver resolver = CatalogManager.catalogUriResolver(CatalogFeatures.defaults(), catalog);
+            String actualSystemId = resolver.resolve("http://remote.com/import/import.xsl", null).getSystemId();
+            Assert.assertTrue(!actualSystemId.contains("//"), "result contains duplicate slashes");
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    /*
+       @bug 8144966
+       Verifies that passing null as CatalogFeatures will result in a NPE.
+    */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testFeatureNull() {
+        CatalogResolver resolver = CatalogManager.catalogResolver(null, "");
+
+    }
+
+    /*
+       @bug 8144966
+       Verifies that passing null as the path will result in a NPE.
+    */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testPathNull() {
+        String path = null;
+        CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), path);
+    }
+
+    /*
        Tests basic catalog feature by using a CatalogResolver instance to
     resolve a DTD reference to a locally specified DTD file. If the resolution
     is successful, the Handler shall return the value of the entity reference
@@ -61,7 +114,7 @@
         }
         String url = getClass().getResource(xml).getFile();
         try {
-            CatalogResolver cr = CatalogManager.catalogResolver(null, catalog);
+            CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalog);
             XMLReader reader = saxParser.getXMLReader();
             reader.setEntityResolver(cr);
             MyHandler handler = new MyHandler(saxParser);
@@ -84,7 +137,7 @@
 
         String test = "testInvalidCatalog";
         try {
-            CatalogResolver resolver = CatalogManager.catalogResolver(null, catalog);
+            CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalog);
             String actualSystemId = resolver.resolveEntity(null, "http://remote/xml/dtd/sys/alice/docAlice.dtd").getSystemId();
         } catch (Exception e) {
             String msg = e.getMessage();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/rewriteCatalog.xml	Fri Jan 15 09:15:33 2016 +0100
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<catalog
+  xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+
+    <rewriteSystem systemIdStartString="http://remote.com/dtd"
+                   rewritePrefix="file:///share/docbook/docbook/pass"/> 
+
+    <rewriteURI uriStartString="http://remote.com/import" rewritePrefix="file:///local/import" />
+    
+</catalog>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/Sources.java	Fri Jan 15 09:15:33 2016 +0100
@@ -0,0 +1,202 @@
+/*
+ * 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.
+ *
+ * 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 common;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URISyntaxException;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/*
+ * @bug 8144967
+ * @summary Tests related to the javax.xml.transform.Source
+ * and org.xml.sax.InputSource
+ */
+public class Sources {
+
+    /**
+     * @bug 8144967
+     * Tests whether a Source object is empty
+     * @param source the Source object
+     */
+    @Test(dataProvider = "emptySources")
+    public void testIsEmpty(Source source) {
+        Assert.assertTrue(source.isEmpty(), "The source is not empty");
+    }
+
+    /**
+     * @bug 8144967
+     * Tests that the source is not empty
+     * @param source the Source object
+     */
+    @Test(dataProvider = "nonEmptySources")
+    public void testIsNotEmpty(Source source) {
+        Assert.assertTrue(!source.isEmpty(), "The source is empty");
+    }
+
+    /**
+     * @bug 8144967
+     * Tests whether an InputSource object is empty
+     * @param source the InputSource object
+     */
+    @Test(dataProvider = "emptyInputSource")
+    public void testISIsEmpty(InputSource source) {
+        Assert.assertTrue(source.isEmpty(), "The source is not empty");
+    }
+
+    /*
+     * DataProvider: sources that are empty
+     */
+    @DataProvider(name = "emptySources")
+    Object[][] getSources() throws URISyntaxException {
+
+        return new Object[][]{
+            {new DOMSource()},
+            {new DOMSource(getDocument())},
+            {new SAXSource()},
+            {new SAXSource(new InputSource(new StringReader("")))},
+            {new SAXSource(getXMLReader(), new InputSource(new StringReader("")))},
+            {new StreamSource()},
+            {new StreamSource(new ByteArrayInputStream("".getBytes()))},
+            {new StreamSource(new StringReader(""))},
+            {new StreamSource(new StringReader(""), null)},
+            {new StreamSource((String) null)}
+        };
+    }
+
+    /*
+     * DataProvider: sources that are not empty
+     */
+    @DataProvider(name = "nonEmptySources")
+    Object[][] getSourcesEx() throws URISyntaxException {
+        StAXSource ss = null;
+        try {
+            ss = new StAXSource(getXMLEventReader());
+        } catch (XMLStreamException ex) {}
+
+        return new Object[][]{
+            //This will set a non-null systemId on the resulting StreamSource
+            {new StreamSource(new File(""))},
+            //Can't tell because XMLStreamReader is a pull parser, cursor advancement
+            //would have been required in order to examine the reader.
+            {new StAXSource(getXMLStreamReader())},
+            {ss}
+        };
+    }
+
+    /*
+     * DataProvider: sources that are empty
+     */
+    @DataProvider(name = "emptyInputSource")
+    Object[][] getInputSources() throws URISyntaxException {
+        byte[] utf8Bytes = null;
+        try {
+            utf8Bytes = "".getBytes("UTF8");
+        } catch (UnsupportedEncodingException ex) {
+            throw new RuntimeException(ex.getMessage());
+        }
+        return new Object[][]{
+            {new InputSource()},
+            {new InputSource(new ByteArrayInputStream(utf8Bytes))},
+            {new InputSource(new StringReader(""))},
+            {new InputSource((String) null)}
+        };
+    }
+
+    /**
+     * Returns an instance of Document.
+     *
+     * @return an instance of Document.
+     */
+    private Document getDocument() {
+        Document doc = null;
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            doc = dbf.newDocumentBuilder().newDocument();
+        } catch (ParserConfigurationException ex) {}
+        return doc;
+    }
+
+    /**
+     * Returns an instance of XMLReader.
+     *
+     * @return an instance of XMLReader.
+     */
+    private XMLReader getXMLReader() {
+        XMLReader reader = null;
+        try {
+            reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
+        } catch (ParserConfigurationException | SAXException ex) {}
+        return reader;
+    }
+
+    /**
+     * Returns an instance of XMLStreamReader.
+     *
+     * @return an instance of XMLStreamReader.
+     */
+    private XMLStreamReader getXMLStreamReader() {
+        XMLStreamReader r = null;
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            r = xif.createXMLStreamReader(new ByteArrayInputStream("".getBytes()));
+        } catch (XMLStreamException ex) {}
+
+        return r;
+    }
+
+    /**
+     * Returns an instance of XMLEventReader.
+     *
+     * @return an instance of XMLEventReader.
+     */
+    private XMLEventReader getXMLEventReader() {
+        XMLEventReader r = null;
+        try {
+            r = XMLInputFactory.newInstance().createXMLEventReader(
+                            new ByteArrayInputStream("".getBytes()));
+        } catch (XMLStreamException ex) {}
+
+        return r;
+    }
+}
--- a/jaxws/.hgtags	Thu Jan 14 14:34:36 2016 +0100
+++ b/jaxws/.hgtags	Fri Jan 15 09:15:33 2016 +0100
@@ -345,3 +345,5 @@
 7293db4716ee25b814e14f738b9acfb85700e3fa jdk-9+97
 67c84077edc3db6b24998b35970b37c01aae985e jdk-9+98
 97b31ca0dd77483cf20ff99a033a455673639578 jdk-9+99
+d0a97e57d2336238edf6a4cd60aafe67deb7258d jdk-9+100
+3e99318616da903e0dc8f07f9f9203dc1bd49921 jdk-9+101
--- a/jdk/.hgtags	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/.hgtags	Fri Jan 15 09:15:33 2016 +0100
@@ -342,3 +342,5 @@
 fdd84b2265ddce7f50e084b7c8635189bba6f012 jdk-9+97
 f86ee68d1107dad41a27efc34306e0e56244a12e jdk-9+98
 e1a789be1535741274c9779f4d4ca3495196b5c3 jdk-9+99
+3d452840f48299a36842760d17c0c8402f0e1266 jdk-9+100
+5e8370fb3ed925335164afe340d1e54beab2d4d5 jdk-9+101
--- a/jdk/make/gendata/GendataBreakIterator.gmk	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/make/gendata/GendataBreakIterator.gmk	Fri Jan 15 09:15:33 2016 +0100
@@ -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/lib/NioLibraries.gmk	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/make/lib/NioLibraries.gmk	Fri Jan 15 09:15:33 2016 +0100
@@ -58,7 +58,10 @@
 ifeq ($(OPENJDK_TARGET_OS), aix)
   BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
   BUILD_LIBNIO_EXFILES += \
-      NativeThread.c
+      /NativeThread.c
+  # Notice: we really need the leading slash here because otherwise every
+  # FILE_NAME in EXCLUDE_FILES will actually match any file ending in FILE_NAME
+  # (e.g. 'NativeThread.c' will also exclude 'AixNativeThread.c').
 endif
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
--- a/jdk/make/mapfiles/libjava/mapfile-vers	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/make/mapfiles/libjava/mapfile-vers	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/make/src/classes/build/tools/dtdbuilder/DTDParser.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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/src/java.base/share/classes/java/io/ObjectInputStream.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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/ClassLoader.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Fri Jan 15 09:15:33 2016 +0100
@@ -50,6 +50,8 @@
 import java.util.Hashtable;
 import java.util.WeakHashMap;
 import java.util.concurrent.ConcurrentHashMap;
+
+import jdk.internal.perf.PerfCounter;
 import sun.misc.Resource;
 import sun.misc.URLClassPath;
 import sun.reflect.CallerSensitive;
@@ -423,9 +425,9 @@
                     c = findClass(name);
 
                     // this is the defining class loader; record the stats
-                    sun.misc.PerfCounter.getParentDelegationTime().addTime(t1 - t0);
-                    sun.misc.PerfCounter.getFindClassTime().addElapsedTimeFrom(t1);
-                    sun.misc.PerfCounter.getFindClasses().increment();
+                    PerfCounter.getParentDelegationTime().addTime(t1 - t0);
+                    PerfCounter.getFindClassTime().addElapsedTimeFrom(t1);
+                    PerfCounter.getFindClasses().increment();
                 }
             }
             if (resolve) {
--- a/jdk/src/java.base/share/classes/java/lang/Integer.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/Integer.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/LiveStackFrame.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/StringCoding.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/System.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/Thread.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/ThreadGroup.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/Throwable.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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/MethodHandles.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -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) {
@@ -3120,6 +3120,8 @@
                                 MethodHandle handler) {
         MethodType ttype = target.type();
         MethodType htype = handler.type();
+        if (!Throwable.class.isAssignableFrom(exType))
+            throw new ClassCastException(exType.getName());
         if (htype.parameterCount() < 1 ||
             !htype.parameterType(0).isAssignableFrom(exType))
             throw newIllegalArgumentException("handler does not accept exception type "+exType);
--- a/jdk/src/java.base/share/classes/java/lang/ref/Cleaner.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Cleaner.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Finalizer.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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/ReferenceQueue.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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/SocketImpl.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/net/SocketImpl.java	Fri Jan 15 09:15:33 2016 +0100
@@ -376,19 +376,23 @@
      * @since 1.9
      */
     protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
-        if (name == StandardSocketOptions.SO_KEEPALIVE) {
+        if (name == StandardSocketOptions.SO_KEEPALIVE &&
+                (getSocket() != null)) {
             setOption(SocketOptions.SO_KEEPALIVE, value);
-        } else if (name == StandardSocketOptions.SO_SNDBUF) {
+        } else if (name == StandardSocketOptions.SO_SNDBUF &&
+                (getSocket() != null)) {
             setOption(SocketOptions.SO_SNDBUF, value);
         } else if (name == StandardSocketOptions.SO_RCVBUF) {
             setOption(SocketOptions.SO_RCVBUF, value);
         } else if (name == StandardSocketOptions.SO_REUSEADDR) {
             setOption(SocketOptions.SO_REUSEADDR, value);
-        } else if (name == StandardSocketOptions.SO_LINGER) {
+        } else if (name == StandardSocketOptions.SO_LINGER &&
+                (getSocket() != null)) {
             setOption(SocketOptions.SO_LINGER, value);
         } else if (name == StandardSocketOptions.IP_TOS) {
             setOption(SocketOptions.IP_TOS, value);
-        } else if (name == StandardSocketOptions.TCP_NODELAY) {
+        } else if (name == StandardSocketOptions.TCP_NODELAY &&
+                (getSocket() != null)) {
             setOption(SocketOptions.TCP_NODELAY, value);
         } else {
             throw new UnsupportedOperationException("unsupported option");
@@ -412,19 +416,23 @@
      */
     @SuppressWarnings("unchecked")
     protected <T> T getOption(SocketOption<T> name) throws IOException {
-        if (name == StandardSocketOptions.SO_KEEPALIVE) {
+        if (name == StandardSocketOptions.SO_KEEPALIVE &&
+                (getSocket() != null)) {
             return (T)getOption(SocketOptions.SO_KEEPALIVE);
-        } else if (name == StandardSocketOptions.SO_SNDBUF) {
+        } else if (name == StandardSocketOptions.SO_SNDBUF &&
+                (getSocket() != null)) {
             return (T)getOption(SocketOptions.SO_SNDBUF);
         } else if (name == StandardSocketOptions.SO_RCVBUF) {
             return (T)getOption(SocketOptions.SO_RCVBUF);
         } else if (name == StandardSocketOptions.SO_REUSEADDR) {
             return (T)getOption(SocketOptions.SO_REUSEADDR);
-        } else if (name == StandardSocketOptions.SO_LINGER) {
+        } else if (name == StandardSocketOptions.SO_LINGER &&
+                (getSocket() != null)) {
             return (T)getOption(SocketOptions.SO_LINGER);
         } else if (name == StandardSocketOptions.IP_TOS) {
             return (T)getOption(SocketOptions.IP_TOS);
-        } else if (name == StandardSocketOptions.TCP_NODELAY) {
+        } else if (name == StandardSocketOptions.TCP_NODELAY &&
+                (getSocket() != null)) {
             return (T)getOption(SocketOptions.TCP_NODELAY);
         } else {
             throw new UnsupportedOperationException("unsupported option");
--- a/jdk/src/java.base/share/classes/java/net/URI.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/net/URI.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/net/URL.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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/URLClassLoader.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/net/URLClassLoader.java	Fri Jan 15 09:15:33 2016 +0100
@@ -52,6 +52,7 @@
 
 import jdk.internal.misc.JavaNetAccess;
 import jdk.internal.misc.SharedSecrets;
+import jdk.internal.perf.PerfCounter;
 import sun.misc.Resource;
 import sun.misc.URLClassPath;
 import sun.net.www.ParseUtil;
@@ -459,14 +460,14 @@
             // Use (direct) ByteBuffer:
             CodeSigner[] signers = res.getCodeSigners();
             CodeSource cs = new CodeSource(url, signers);
-            sun.misc.PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
+            PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
             return defineClass(name, bb, cs);
         } else {
             byte[] b = res.getBytes();
             // must read certificates AFTER reading bytes.
             CodeSigner[] signers = res.getCodeSigners();
             CodeSource cs = new CodeSource(url, signers);
-            sun.misc.PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
+            PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
             return defineClass(name, b, 0, b.length, cs);
         }
     }
--- a/jdk/src/java.base/share/classes/java/net/URLConnection.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/net/URLConnection.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/nio/Bits.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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/security/ProtectionDomain.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/security/ProtectionDomain.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -27,12 +27,12 @@
 
 import java.lang.ref.Reference;
 import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Map;
-import java.util.WeakHashMap;
 import java.util.concurrent.ConcurrentHashMap;
 import jdk.internal.misc.JavaSecurityAccess;
 import jdk.internal.misc.JavaSecurityProtectionDomainAccess;
@@ -472,11 +472,15 @@
      *
      * This class stores ProtectionDomains as weak keys in a ConcurrentHashMap
      * with additional support for checking and removing weak keys that are no
-     * longer in use.
+     * longer in use. There can be cases where the permission collection may
+     * have a chain of strong references back to the ProtectionDomain, which
+     * ordinarily would prevent the entry from being removed from the map. To
+     * address that, we wrap the permission collection in a SoftReference so
+     * that it can be reclaimed by the garbage collector due to memory demand.
      */
     private static class PDCache implements ProtectionDomainCache {
         private final ConcurrentHashMap<WeakProtectionDomainKey,
-                                        PermissionCollection>
+                                        SoftReference<PermissionCollection>>
                                         pdMap = new ConcurrentHashMap<>();
         private final ReferenceQueue<Key> queue = new ReferenceQueue<>();
 
@@ -485,15 +489,15 @@
             processQueue(queue, pdMap);
             WeakProtectionDomainKey weakPd =
                 new WeakProtectionDomainKey(pd, queue);
-            pdMap.putIfAbsent(weakPd, pc);
+            pdMap.put(weakPd, new SoftReference<>(pc));
         }
 
         @Override
         public PermissionCollection get(ProtectionDomain pd) {
             processQueue(queue, pdMap);
-            WeakProtectionDomainKey weakPd =
-                new WeakProtectionDomainKey(pd, queue);
-            return pdMap.get(weakPd);
+            WeakProtectionDomainKey weakPd = new WeakProtectionDomainKey(pd);
+            SoftReference<PermissionCollection> sr = pdMap.get(weakPd);
+            return (sr == null) ? null : sr.get();
         }
 
         /**
@@ -533,11 +537,20 @@
             this((pd == null ? NULL_KEY : pd.key), rq);
         }
 
+        WeakProtectionDomainKey(ProtectionDomain pd) {
+            this(pd == null ? NULL_KEY : pd.key);
+        }
+
         private WeakProtectionDomainKey(Key key, ReferenceQueue<Key> rq) {
             super(key, rq);
             hash = key.hashCode();
         }
 
+        private WeakProtectionDomainKey(Key key) {
+            super(key);
+            hash = key.hashCode();
+        }
+
         /**
          * Returns the identity hash code of the original referent.
          */
--- a/jdk/src/java.base/share/classes/java/time/Clock.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/time/Clock.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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/Duration.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/time/Duration.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1194,6 +1194,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the whole seconds part of the length of the duration, positive or negative
+     * @since 9
      */
     public long toSeconds() {
         return seconds;
@@ -1243,6 +1244,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the number of days in the duration, may be negative
+     * @since 9
      */
     public long toDaysPart(){
         return seconds / SECONDS_PER_DAY;
@@ -1258,6 +1260,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the number of hours part in the duration, may be negative
+     * @since 9
      */
     public int toHoursPart(){
         return (int) (toHours() % 24);
@@ -1273,7 +1276,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the number of minutes parts in the duration, may be negative
-     * may be negative
+     * @since 9
      */
     public int toMinutesPart(){
         return (int) (toMinutes() % MINUTES_PER_HOUR);
@@ -1289,6 +1292,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the number of seconds parts in the duration, may be negative
+     * @since 9
      */
     public int toSecondsPart(){
         return (int) (seconds % SECONDS_PER_MINUTE);
@@ -1306,6 +1310,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the number of milliseconds part of the duration.
+     * @since 9
      */
     public int toMillisPart(){
         return nanos / 1000_000;
@@ -1322,6 +1327,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the nanoseconds within the second part of the length of the duration, from 0 to 999,999,999
+     * @since 9
      */
     public int toNanosPart(){
         return nanos;
@@ -1385,7 +1391,7 @@
      * <p>
      * The format of the returned string will be {@code PTnHnMnS}, where n is
      * the relevant hours, minutes or seconds part of the duration.
-     * Any fractional seconds are placed after a decimal point i the seconds section.
+     * Any fractional seconds are placed after a decimal point in the seconds section.
      * If a section has a zero value, it is omitted.
      * The hours, minutes and seconds will all have the same sign.
      * <p>
@@ -1406,9 +1412,13 @@
         if (this == ZERO) {
             return "PT0S";
         }
-        long hours = seconds / SECONDS_PER_HOUR;
-        int minutes = (int) ((seconds % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE);
-        int secs = (int) (seconds % SECONDS_PER_MINUTE);
+        long effectiveTotalSecs = seconds;
+        if (seconds < 0 && nanos > 0) {
+            effectiveTotalSecs++;
+        }
+        long hours = effectiveTotalSecs / SECONDS_PER_HOUR;
+        int minutes = (int) ((effectiveTotalSecs % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE);
+        int secs = (int) (effectiveTotalSecs % SECONDS_PER_MINUTE);
         StringBuilder buf = new StringBuilder(24);
         buf.append("PT");
         if (hours != 0) {
@@ -1420,18 +1430,18 @@
         if (secs == 0 && nanos == 0 && buf.length() > 2) {
             return buf.toString();
         }
-        if (secs < 0 && nanos > 0) {
-            if (secs == -1) {
+        if (seconds < 0 && nanos > 0) {
+            if (secs == 0) {
                 buf.append("-0");
             } else {
-                buf.append(secs + 1);
+                buf.append(secs);
             }
         } else {
             buf.append(secs);
         }
         if (nanos > 0) {
             int pos = buf.length();
-            if (secs < 0) {
+            if (seconds < 0) {
                 buf.append(2 * NANOS_PER_SECOND - nanos);
             } else {
                 buf.append(nanos + NANOS_PER_SECOND);
--- a/jdk/src/java.base/share/classes/java/time/LocalDate.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/time/LocalDate.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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/Calendar.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/Calendar.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -2085,8 +2085,10 @@
 
         String calendarType = getCalendarType();
         int fieldValue = get(field);
-        // the standalone and narrow styles are supported only through CalendarDataProviders.
-        if (isStandaloneStyle(style) || isNarrowFormatStyle(style)) {
+        // the standalone/narrow styles and short era are supported only through
+        // CalendarNameProviders.
+        if (isStandaloneStyle(style) || isNarrowFormatStyle(style) ||
+            field == ERA && (style & SHORT) == SHORT) {
             String val = CalendarDataUtility.retrieveFieldValueName(calendarType,
                                                                     field, fieldValue,
                                                                     style, locale);
--- a/jdk/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java	Fri Jan 15 09:15:33 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -1037,14 +1037,16 @@
                 }
                 if (size < eras.length) {
                     int baseStyle = getBaseStyle(style);
-                    for (int i = size; i < eras.length; i++) {
-                        Era era = eras[i];
-                        if (baseStyle == ALL_STYLES || baseStyle == SHORT
-                                || baseStyle == NARROW_FORMAT) {
-                            names.put(era.getAbbreviation(), i);
-                        }
-                        if (baseStyle == ALL_STYLES || baseStyle == LONG) {
-                            names.put(era.getName(), i);
+                    for (int i = 0; i < eras.length; i++) {
+                        if (!names.values().contains(i)) {
+                            Era era = eras[i];
+                            if (baseStyle == ALL_STYLES || baseStyle == SHORT
+                                    || baseStyle == NARROW_FORMAT) {
+                                names.put(era.getAbbreviation(), i);
+                            }
+                            if (baseStyle == ALL_STYLES || baseStyle == LONG) {
+                                names.put(era.getName(), i);
+                            }
                         }
                     }
                 }
--- a/jdk/src/java.base/share/classes/java/util/Locale.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/Locale.java	Fri Jan 15 09:15:33 2016 +0100
@@ -3144,6 +3144,18 @@
                    && range.equals(other.range)
                    && weight == other.weight;
         }
+
+        /**
+         * Returns an informative string representation of this {@code LanguageRange}
+         * object, consisting of language range and weight if the range is
+         * weighted and the weight is less than the max weight.
+         *
+         * @return a string representation of this {@code LanguageRange} object.
+         */
+        @Override
+        public String toString() {
+            return (weight == MAX_WEIGHT) ? range : range + ";q=" + weight;
+        }
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java	Fri Jan 15 09:15:33 2016 +0100
@@ -54,6 +54,7 @@
 import java.util.stream.StreamSupport;
 import jdk.internal.misc.JavaUtilZipFileAccess;
 import jdk.internal.misc.SharedSecrets;
+import jdk.internal.perf.PerfCounter;
 
 import static java.util.zip.ZipConstants.*;
 import static java.util.zip.ZipConstants64.*;
@@ -210,8 +211,8 @@
         this.name = name;
         long t0 = System.nanoTime();
         this.zsrc = Source.get(file, (mode & OPEN_DELETE) != 0);
-        sun.misc.PerfCounter.getZipFileOpenTime().addElapsedTimeFrom(t0);
-        sun.misc.PerfCounter.getZipFileCount().increment();
+        PerfCounter.getZipFileOpenTime().addElapsedTimeFrom(t0);
+        PerfCounter.getZipFileCount().increment();
     }
 
     /**
@@ -1251,7 +1252,7 @@
                     idx = getEntryNext(idx);
                 }
                 /* If not addSlash, or slash is already there, we are done */
-                if (!addSlash  || name[name.length - 1] == '/') {
+                if (!addSlash  || name.length == 0 || name[name.length - 1] == '/') {
                      return -1;
                 }
                 /* Add slash and try once more */
--- a/jdk/src/java.base/share/classes/jdk/Exported.java	Thu Jan 14 14:34:36 2016 +0100
+++ /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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ /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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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 09:15:33 2016 +0100
@@ -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 09:15:33 2016 +0100
@@ -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/perf/Perf.java	Fri Jan 15 09:15:33 2016 +0100
@@ -0,0 +1,547 @@
+/*
+ * Copyright (c) 2002, 2006, 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.perf;
+
+import java.nio.ByteBuffer;
+import java.security.Permission;
+import java.security.PrivilegedAction;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import jdk.internal.ref.CleanerFactory;
+
+/**
+ * The Perf class provides the ability to attach to an instrumentation
+ * buffer maintained by a Java virtual machine. The instrumentation
+ * buffer may be for the Java virtual machine running the methods of
+ * this class or it may be for another Java virtual machine on the
+ * same system.
+ * <p>
+ * In addition, this class provides methods to create instrumentation
+ * objects in the instrumentation buffer for the Java virtual machine
+ * that is running these methods. It also contains methods for acquiring
+ * the value of a platform specific high resolution clock for time
+ * stamp and interval measurement purposes.
+ *
+ * @author   Brian Doherty
+ * @since    1.4.2
+ * @see      #getPerf
+ * @see      jdk.internal.perf.Perf.GetPerfAction
+ * @see      java.nio.ByteBuffer
+ */
+public final class Perf {
+
+    private static Perf instance;
+
+    private static final int PERF_MODE_RO = 0;
+    private static final int PERF_MODE_RW = 1;
+
+    private Perf() { }    // prevent instantiation
+
+    /**
+     * The GetPerfAction class is a convenience class for acquiring access
+     * to the singleton Perf instance using the
+     * <code>AccessController.doPrivileged()</code> method.
+     * <p>
+     * An instance of this class can be used as the argument to
+     * <code>AccessController.doPrivileged(PrivilegedAction)</code>.
+     * <p> Here is a suggested idiom for use of this class:
+     *
+     * <blockquote><pre>{@code
+     * class MyTrustedClass {
+     *   private static final Perf perf =
+     *       AccessController.doPrivileged(new Perf.GetPerfAction<Perf>());
+     *   ...
+     * }
+     * }</pre></blockquote>
+     * <p>
+     * In the presence of a security manager, the <code>MyTrustedClass</code>
+     * class in the above example will need to be granted the
+     * <em>"sun.misc.Perf.getPerf"</em> <code>RuntimePermission</code>
+     * permission in order to successfully acquire the singleton Perf instance.
+     * <p>
+     * Please note that the <em>"sun.misc.Perf.getPerf"</em> permission
+     * is not a JDK specified permission.
+     *
+     * @see  java.security.AccessController#doPrivileged(PrivilegedAction)
+     * @see  java.lang.RuntimePermission
+     */
+    public static class GetPerfAction implements PrivilegedAction<Perf>
+    {
+        /**
+         * Run the <code>Perf.getPerf()</code> method in a privileged context.
+         *
+         * @see #getPerf
+         */
+        public Perf run() {
+            return getPerf();
+        }
+    }
+
+    /**
+     * Return a reference to the singleton Perf instance.
+     * <p>
+     * The getPerf() method returns the singleton instance of the Perf
+     * class. The returned object provides the caller with the capability
+     * for accessing the instrumentation buffer for this or another local
+     * Java virtual machine.
+     * <p>
+     * If a security manager is installed, its <code>checkPermission</code>
+     * method is called with a <code>RuntimePermission</code> with a target
+     * of <em>"sun.misc.Perf.getPerf"</em>. A security exception will result
+     * if the caller has not been granted this permission.
+     * <p>
+     * Access to the returned <code>Perf</code> object should be protected
+     * by its caller and not passed on to untrusted code. This object can
+     * be used to attach to the instrumentation buffer provided by this Java
+     * virtual machine or for those of other Java virtual machines running
+     * on the same system. The instrumentation buffer may contain senstitive
+     * information. API's built on top of this interface may want to provide
+     * finer grained access control to the contents of individual
+     * instrumentation objects contained within the buffer.
+     * <p>
+     * Please note that the <em>"sun.misc.Perf.getPerf"</em> permission
+     * is not a JDK specified permission.
+     *
+     * @return  A reference to the singleton Perf instance.
+     * @throws SecurityException  if a security manager exists and its
+     *         <code>checkPermission</code> method doesn't allow access
+     *         to the <em>"jdk.internal.perf.Perf.getPerf""</em> target.
+     * @see  java.lang.RuntimePermission
+     * @see  #attach
+     */
+    public static Perf getPerf()
+    {
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            Permission perm = new RuntimePermission("jdk.internal.perf.Perf.getPerf");
+            security.checkPermission(perm);
+        }
+
+        return instance;
+    }
+
+    /**
+     * Attach to the instrumentation buffer for the specified Java virtual
+     * machine.
+     * <p>
+     * This method will attach to the instrumentation buffer for the
+     * specified virtual machine. It returns a <code>ByteBuffer</code> object
+     * that is initialized to access the instrumentation buffer for the
+     * indicated Java virtual machine. The <code>lvmid</code> parameter is
+     * a integer value that uniquely identifies the target local Java virtual
+     * machine. It is typically, but not necessarily, the process id of
+     * the target Java virtual machine.
+     * <p>
+     * If the <code>lvmid</code> identifies a Java virtual machine different
+     * from the one running this method, then the coherency characteristics
+     * of the buffer are implementation dependent. Implementations that do
+     * not support named, coherent, shared memory may return a
+     * <code>ByteBuffer</code> object that contains only a snap shot of the
+     * data in the instrumentation buffer. Implementations that support named,
+     * coherent, shared memory, may return a <code>ByteBuffer</code> object
+     * that will be changing dynamically over time as the target Java virtual
+     * machine updates its mapping of this buffer.
+     * <p>
+     * If the <code>lvmid</code> is 0 or equal to the actual <code>lvmid</code>
+     * for the Java virtual machine running this method, then the returned
+     * <code>ByteBuffer</code> object will always be coherent and dynamically
+     * changing.
+     * <p>
+     * The attach mode specifies the access permissions requested for the
+     * instrumentation buffer of the target virtual machine. The permitted
+     * access permissions are:
+     * <ul>
+     * <li>"r"  - Read only access. This Java virtual machine has only
+     * read access to the instrumentation buffer for the target Java
+     * virtual machine.
+     * <li>"rw"  - Read/Write access. This Java virtual machine has read and
+     * write access to the instrumentation buffer for the target Java virtual
+     * machine. This mode is currently not supported and is reserved for
+     * future enhancements.
+     * </ul>
+     *
+     * @param   lvmid            an integer that uniquely identifies the
+     *                           target local Java virtual machine.
+     * @param   mode             a string indicating the attach mode.
+     * @return  ByteBuffer       a direct allocated byte buffer
+     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
+     * @throws  IOException      An I/O error occurred while trying to acquire
+     *                           the instrumentation buffer.
+     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
+     *                           into the virtual machine's address space.
+     * @see     java.nio.ByteBuffer
+     */
+    public ByteBuffer attach(int lvmid, String mode)
+           throws IllegalArgumentException, IOException
+    {
+        if (mode.compareTo("r") == 0) {
+            return attachImpl(null, lvmid, PERF_MODE_RO);
+        }
+        else if (mode.compareTo("rw") == 0) {
+            return attachImpl(null, lvmid, PERF_MODE_RW);
+        }
+        else {
+            throw new IllegalArgumentException("unknown mode");
+        }
+    }
+
+    /**
+     * Attach to the instrumentation buffer for the specified Java virtual
+     * machine owned by the given user.
+     * <p>
+     * This method behaves just as the <code>attach(int lvmid, String mode)
+     * </code> method, except that it only searches for Java virtual machines
+     * owned by the specified user.
+     *
+     * @param   user             A <code>String</code> object containing the
+     *                           name of the user that owns the target Java
+     *                           virtual machine.
+     * @param   lvmid            an integer that uniquely identifies the
+     *                           target local Java virtual machine.
+     * @param   mode             a string indicating the attach mode.
+     * @return  ByteBuffer       a direct allocated byte buffer
+     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
+     * @throws  IOException      An I/O error occurred while trying to acquire
+     *                           the instrumentation buffer.
+     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
+     *                           into the virtual machine's address space.
+     * @see     java.nio.ByteBuffer
+     */
+    public ByteBuffer attach(String user, int lvmid, String mode)
+           throws IllegalArgumentException, IOException
+    {
+        if (mode.compareTo("r") == 0) {
+            return attachImpl(user, lvmid, PERF_MODE_RO);
+        }
+        else if (mode.compareTo("rw") == 0) {
+            return attachImpl(user, lvmid, PERF_MODE_RW);
+        }
+        else {
+            throw new IllegalArgumentException("unknown mode");
+        }
+    }
+
+    /**
+     * Call the implementation specific attach method.
+     * <p>
+     * This method calls into the Java virtual machine to perform the platform
+     * specific attach method. Buffers returned from this method are
+     * internally managed as <code>PhantomRefereces</code> to provide for
+     * guaranteed, secure release of the native resources.
+     *
+     * @param   user             A <code>String</code> object containing the
+     *                           name of the user that owns the target Java
+     *                           virtual machine.
+     * @param   lvmid            an integer that uniquely identifies the
+     *                           target local Java virtual machine.
+     * @param   mode             a string indicating the attach mode.
+     * @return  ByteBuffer       a direct allocated byte buffer
+     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
+     * @throws  IOException      An I/O error occurred while trying to acquire
+     *                           the instrumentation buffer.
+     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
+     *                           into the virtual machine's address space.
+     */
+    private ByteBuffer attachImpl(String user, int lvmid, int mode)
+            throws IllegalArgumentException, IOException
+    {
+        final ByteBuffer b = attach(user, lvmid, mode);
+
+        if (lvmid == 0) {
+            // The native instrumentation buffer for this Java virtual
+            // machine is never unmapped.
+            return b;
+        }
+        else {
+            // This is an instrumentation buffer for another Java virtual
+            // machine with native resources that need to be managed. We
+            // create a duplicate of the native ByteBuffer and manage it
+            // with a Cleaner. When the duplicate becomes phantom reachable,
+            // the native resources will be released.
+
+            final ByteBuffer dup = b.duplicate();
+
+            CleanerFactory.cleaner()
+                          .register(dup, new CleanerAction(instance, b));
+            return dup;
+        }
+    }
+
+    private static class CleanerAction implements Runnable {
+        private final ByteBuffer bb;
+        private final Perf perf;
+        CleanerAction(Perf perf, ByteBuffer bb) {
+            this.perf = perf;
+            this.bb = bb;
+        }
+        public void run() {
+            try {
+                perf.detach(bb);
+            } catch (Throwable th) {
+                // avoid crashing the reference handler thread,
+                // but provide for some diagnosability
+                assert false : th.toString();
+            }
+        }
+    }
+
+    /**
+     * Native method to perform the implementation specific attach mechanism.
+     * <p>
+     * The implementation of this method may return distinct or identical
+     * <code>ByteBuffer</code> objects for two distinct calls requesting
+     * attachment to the same Java virtual machine.
+     * <p>
+     * For the Sun HotSpot JVM, two distinct calls to attach to the same
+     * target Java virtual machine will result in two distinct ByteBuffer
+     * objects returned by this method. This may change in a future release.
+     *
+     * @param   user             A <code>String</code> object containing the
+     *                           name of the user that owns the target Java
+     *                           virtual machine.
+     * @param   lvmid            an integer that uniquely identifies the
+     *                           target local Java virtual machine.
+     * @param   mode             a string indicating the attach mode.
+     * @return  ByteBuffer       a direct allocated byte buffer
+     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
+     * @throws  IOException      An I/O error occurred while trying to acquire
+     *                           the instrumentation buffer.
+     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
+     *                           into the virtual machine's address space.
+     */
+    private native ByteBuffer attach(String user, int lvmid, int mode)
+                   throws IllegalArgumentException, IOException;
+
+    /**
+     * Native method to perform the implementation specific detach mechanism.
+     * <p>
+     * If this method is passed a <code>ByteBuffer</code> object that is
+     * not created by the <code>attach</code> method, then the results of
+     * this method are undefined, with unpredictable and potentially damaging
+     * effects to the Java virtual machine. To prevent accidental or malicious
+     * use of this method, all native ByteBuffer created by the <code>
+     * attach</code> method are managed internally as PhantomReferences
+     * and resources are freed by the system.
+     * <p>
+     * If this method is passed a <code>ByteBuffer</code> object created
+     * by the <code>attach</code> method with a lvmid for the Java virtual
+     * machine running this method (lvmid=0, for example), then the detach
+     * request is silently ignored.
+     *
+     * @param bb  A direct allocated byte buffer created by the
+     *                    <code>attach</code> method.
+     * @see   java.nio.ByteBuffer
+     * @see   #attach
+     */
+    private native void detach(ByteBuffer bb);
+
+    /**
+     * Create a <code>long</code> scalar entry in the instrumentation buffer
+     * with the given variability characteristic, units, and initial value.
+     * <p>
+     * Access to the instrument is provided through the returned <code>
+     * ByteBuffer</code> object. Typically, this object should be wrapped
+     * with <code>LongBuffer</code> view object.
+     *
+     * @param   variability the variability characteristic for this entry.
+     * @param   units       the units for this entry.
+     * @param   name        the name of this entry.
+     * @param   value       the initial value for this entry.
+     * @return  ByteBuffer  a direct allocated ByteBuffer object that
+     *                      allows write access to a native memory location
+     *                      containing a <code>long</code> value.
+     *
+     * see sun.misc.perf.Variability
+     * see sun.misc.perf.Units
+     * @see java.nio.ByteBuffer
+     */
+    public native ByteBuffer createLong(String name, int variability,
+                                        int units, long value);
+
+    /**
+     * Create a <code>String</code> entry in the instrumentation buffer with
+     * the given variability characteristic, units, and initial value.
+     * <p>
+     * The maximum length of the <code>String</code> stored in this string
+     * instrument is given in by <code>maxLength</code> parameter. Updates
+     * to this instrument with <code>String</code> values with lengths greater
+     * than <code>maxLength</code> will be truncated to <code>maxLength</code>.
+     * The truncated value will be terminated by a null character.
+     * <p>
+     * The underlying implementation may further limit the length of the
+     * value, but will continue to preserve the null terminator.
+     * <p>
+     * Access to the instrument is provided through the returned <code>
+     * ByteBuffer</code> object.
+     *
+     * @param   variability the variability characteristic for this entry.
+     * @param   units       the units for this entry.
+     * @param   name        the name of this entry.
+     * @param   value       the initial value for this entry.
+     * @param   maxLength   the maximum string length for this string
+     *                      instrument.
+     * @return  ByteBuffer  a direct allocated ByteBuffer that allows
+     *                      write access to a native memory location
+     *                      containing a <code>long</code> value.
+     *
+     * see sun.misc.perf.Variability
+     * see sun.misc.perf.Units
+     * @see java.nio.ByteBuffer
+     */
+    public ByteBuffer createString(String name, int variability,
+                                   int units, String value, int maxLength)
+    {
+        byte[] v = getBytes(value);
+        byte[] v1 = new byte[v.length+1];
+        System.arraycopy(v, 0, v1, 0, v.length);
+        v1[v.length] = '\0';
+        return createByteArray(name, variability, units, v1, Math.max(v1.length, maxLength));
+    }
+
+    /**
+     * Create a <code>String</code> entry in the instrumentation buffer with
+     * the given variability characteristic, units, and initial value.
+     * <p>
+     * The maximum length of the <code>String</code> stored in this string
+     * instrument is implied by the length of the <code>value</code> parameter.
+     * Subsequent updates to the value of this instrument will be truncated
+     * to this implied maximum length. The truncated value will be terminated
+     * by a null character.
+     * <p>
+     * The underlying implementation may further limit the length of the
+     * initial or subsequent value, but will continue to preserve the null
+     * terminator.
+     * <p>
+     * Access to the instrument is provided through the returned <code>
+     * ByteBuffer</code> object.
+     *
+     * @param   variability the variability characteristic for this entry.
+     * @param   units       the units for this entry.
+     * @param   name        the name of this entry.
+     * @param   value       the initial value for this entry.
+     * @return  ByteBuffer  a direct allocated ByteBuffer that allows
+     *                      write access to a native memory location
+     *                      containing a <code>long</code> value.
+     *
+     * see sun.misc.perf.Variability
+     * see sun.misc.perf.Units
+     * @see java.nio.ByteBuffer
+     */
+    public ByteBuffer createString(String name, int variability,
+                                   int units, String value)
+    {
+        byte[] v = getBytes(value);
+        byte[] v1 = new byte[v.length+1];
+        System.arraycopy(v, 0, v1, 0, v.length);
+        v1[v.length] = '\0';
+        return createByteArray(name, variability, units, v1, v1.length);
+    }
+
+    /**
+     * Create a <code>byte</code> vector entry in the instrumentation buffer
+     * with the given variability characteristic, units, and initial value.
+     * <p>
+     * The <code>maxLength</code> parameter limits the size of the byte
+     * array instrument such that the initial or subsequent updates beyond
+     * this length are silently ignored. No special handling of truncated
+     * updates is provided.
+     * <p>
+     * The underlying implementation may further limit the length of the
+     * length of the initial or subsequent value.
+     * <p>
+     * Access to the instrument is provided through the returned <code>
+     * ByteBuffer</code> object.
+     *
+     * @param   variability the variability characteristic for this entry.
+     * @param   units       the units for this entry.
+     * @param   name        the name of this entry.
+     * @param   value       the initial value for this entry.
+     * @param   maxLength   the maximum length of this byte array.
+     * @return  ByteBuffer  a direct allocated byte buffer that allows
+     *                      write access to a native memory location
+     *                      containing a <code>long</code> value.
+     *
+     * see sun.misc.perf.Variability
+     * see sun.misc.perf.Units
+     * @see java.nio.ByteBuffer
+     */
+    public native ByteBuffer createByteArray(String name, int variability,
+                                             int units, byte[] value,
+                                             int maxLength);
+
+
+    /**
+     * convert string to an array of UTF-8 bytes
+     */
+    private static byte[] getBytes(String s)
+    {
+        byte[] bytes = null;
+
+        try {
+            bytes = s.getBytes("UTF-8");
+        }
+        catch (UnsupportedEncodingException e) {
+            // ignore, UTF-8 encoding is always known
+        }
+
+        return bytes;
+    }
+
+    /**
+     * Return the value of the High Resolution Counter.
+     *
+     * The High Resolution Counter returns the number of ticks since
+     * since the start of the Java virtual machine. The resolution of
+     * the counter is machine dependent and can be determined from the
+     * value return by the {@link #highResFrequency} method.
+     *
+     * @return  the number of ticks of machine dependent resolution since
+     *          the start of the Java virtual machine.
+     *
+     * @see #highResFrequency
+     * @see java.lang.System#currentTimeMillis()
+     */
+    public native long highResCounter();
+
+    /**
+     * Returns the frequency of the High Resolution Counter, in ticks per
+     * second.
+     *
+     * This value can be used to convert the value of the High Resolution
+     * Counter, as returned from a call to the {@link #highResCounter} method,
+     * into the number of seconds since the start of the Java virtual machine.
+     *
+     * @return  the frequency of the High Resolution Counter.
+     * @see #highResCounter
+     */
+    public native long highResFrequency();
+
+    private static native void registerNatives();
+
+    static {
+        registerNatives();
+        instance = new Perf();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/perf/PerfCounter.java	Fri Jan 15 09:15:33 2016 +0100
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2009, 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.perf;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.LongBuffer;
+import java.security.AccessController;
+
+/**
+ * Performance counter support for internal JRE classes.
+ * This class defines a fixed list of counters for the platform
+ * to use as an interim solution until RFE# 6209222 is implemented.
+ * The perf counters will be created in the jvmstat perf buffer
+ * that the HotSpot VM creates. The default size is 32K and thus
+ * the number of counters is bounded.  You can alter the size
+ * with {@code -XX:PerfDataMemorySize=<bytes>} option. If there is
+ * insufficient memory in the jvmstat perf buffer, the C heap memory
+ * will be used and thus the application will continue to run if
+ * the counters added exceeds the buffer size but the counters
+ * will be missing.
+ *
+ * See HotSpot jvmstat implementation for certain circumstances
+ * that the jvmstat perf buffer is not supported.
+ *
+ */
+public class PerfCounter {
+    private static final Perf perf =
+        AccessController.doPrivileged(new Perf.GetPerfAction());
+
+    // Must match values defined in hotspot/src/share/vm/runtime/perfdata.hpp
+    private static final int V_Constant  = 1;
+    private static final int V_Monotonic = 2;
+    private static final int V_Variable  = 3;
+    private static final int U_None      = 1;
+
+    private final String name;
+    private final LongBuffer lb;
+
+    private PerfCounter(String name, int type) {
+        this.name = name;
+        ByteBuffer bb = perf.createLong(name, type, U_None, 0L);
+        bb.order(ByteOrder.nativeOrder());
+        this.lb = bb.asLongBuffer();
+    }
+
+    static PerfCounter newPerfCounter(String name) {
+        return new PerfCounter(name, V_Variable);
+    }
+
+    static PerfCounter newConstantPerfCounter(String name) {
+        PerfCounter c = new PerfCounter(name, V_Constant);
+        return c;
+    }
+
+    /**
+     * Returns the current value of the perf counter.
+     */
+    public synchronized long get() {
+        return lb.get(0);
+    }
+
+    /**
+     * Sets the value of the perf counter to the given newValue.
+     */
+    public synchronized void set(long newValue) {
+        lb.put(0, newValue);
+    }
+
+    /**
+     * Adds the given value to the perf counter.
+     */
+    public synchronized void add(long value) {
+        long res = get() + value;
+        lb.put(0, res);
+    }
+
+    /**
+     * Increments the perf counter with 1.
+     */
+    public void increment() {
+        add(1);
+    }
+
+    /**
+     * Adds the given interval to the perf counter.
+     */
+    public void addTime(long interval) {
+        add(interval);
+    }
+
+    /**
+     * Adds the elapsed time from the given start time (ns) to the perf counter.
+     */
+    public void addElapsedTimeFrom(long startTime) {
+        add(System.nanoTime() - startTime);
+    }
+
+    @Override
+    public String toString() {
+        return name + " = " + get();
+    }
+
+    static class CoreCounters {
+        static final PerfCounter pdt   = newPerfCounter("sun.classloader.parentDelegationTime");
+        static final PerfCounter lc    = newPerfCounter("sun.classloader.findClasses");
+        static final PerfCounter lct   = newPerfCounter("sun.classloader.findClassTime");
+        static final PerfCounter rcbt  = newPerfCounter("sun.urlClassLoader.readClassBytesTime");
+        static final PerfCounter zfc   = newPerfCounter("sun.zip.zipFiles");
+        static final PerfCounter zfot  = newPerfCounter("sun.zip.zipFile.openTime");
+    }
+
+    static class WindowsClientCounters {
+        static final PerfCounter d3dAvailable = newConstantPerfCounter("sun.java2d.d3d.available");
+    }
+
+    /**
+     * Number of findClass calls
+     */
+    public static PerfCounter getFindClasses() {
+        return CoreCounters.lc;
+    }
+
+    /**
+     * Time (ns) spent in finding classes that includes
+     * lookup and read class bytes and defineClass
+     */
+    public static PerfCounter getFindClassTime() {
+        return CoreCounters.lct;
+    }
+
+    /**
+     * Time (ns) spent in finding classes
+     */
+    public static PerfCounter getReadClassBytesTime() {
+        return CoreCounters.rcbt;
+    }
+
+    /**
+     * Time (ns) spent in the parent delegation to
+     * the parent of the defining class loader
+     */
+    public static PerfCounter getParentDelegationTime() {
+        return CoreCounters.pdt;
+    }
+
+    /**
+     * Number of zip files opened.
+     */
+    public static PerfCounter getZipFileCount() {
+        return CoreCounters.zfc;
+    }
+
+    /**
+     * Time (ns) spent in opening the zip files that
+     * includes building the entries hash table
+     */
+    public static PerfCounter getZipFileOpenTime() {
+        return CoreCounters.zfot;
+    }
+
+    /**
+     * D3D graphic pipeline available
+     */
+    public static PerfCounter getD3DAvailable() {
+        return WindowsClientCounters.d3dAvailable;
+    }
+}
--- /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 09:15:33 2016 +0100
@@ -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 09:15:33 2016 +0100
@@ -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 09:15:33 2016 +0100
@@ -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 09:15:33 2016 +0100
@@ -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 09:15:33 2016 +0100
@@ -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");
+    }
+}
--- a/jdk/src/java.base/share/classes/jdk/net/ExtendedSocketOptions.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/net/ExtendedSocketOptions.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/net/NetworkPermission.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/net/SocketFlow.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/net/Sockets.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/jdk/net/package-info.java	Fri Jan 15 09:15:33 2016 +0100
@@ -30,5 +30,4 @@
  * @since 1.8
  */
 
-@jdk.Exported
 package jdk.net;
--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Thu Jan 14 14:34:36 2016 +0100
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Fri Jan 15 09:15:33 2016 +0100
@@ -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/CEFormatException.java	Thu Jan 14 14:34:36 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 1995, 2011, 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 java.io.IOException;
-
-public class CEFormatException extends IOException {
-    static final long serialVersionUID = -7139121221067081482L;
-    public CEFormatException(String s) {
-        super(s);
-    }
-}
-
--- a/jdk/src/java.base/share/classes/sun/misc/CEStreamExhausted.java	Thu Jan 14 14:34:36 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 1995, 2011, 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 java.io.IOException;
-
-/** This exception is thrown when EOF is reached */
-public class CEStreamExhausted extends IOException {
-    static final long serialVersionUID = -5889118049525891904L;
-}
-
--- a/jdk/src/java.base/share/classes/sun/misc/JarFilter.java	Thu Jan 14 14:34:36 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, 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 java.io.File;
-import java.io.FilenameFilter;
-
-/**
- * This class checks that only jar and zip files are included in the file list.
- * This class is used in extension installation support (ExtensionDependency).
- *
- * @deprecated this class will be removed in a future release.
- * @author  Michael Colburn
- */
-@Deprecated
-public class JarFilter implements FilenameFilter {
-
-    public boolean accept(File dir, String name) {
-        String lower = name.toLowerCase();
-        return lower.endsWith(".jar") || lower.endsWith(".zip");
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/misc/MessageUtils.java	Thu Jan 14 14:34:36 2016 +0100
+++ /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/Perf.java	Thu Jan 14 14:34:36 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,538 +0,0 @@
-/*
- * Copyright (c) 2002, 2006, 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 java.nio.ByteBuffer;
-import java.security.Permission;
-import java.security.PrivilegedAction;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-
-/**
- * The Perf class provides the ability to attach to an instrumentation
- * buffer maintained by a Java virtual machine. The instrumentation
- * buffer may be for the Java virtual machine running the methods of
- * this class or it may be for another Java virtual machine on the
- * same system.
- * <p>
- * In addition, this class provides methods to create instrumentation
- * objects in the instrumentation buffer for the Java virtual machine
- * that is running these methods. It also contains methods for acquiring
- * the value of a platform specific high resolution clock for time
- * stamp and interval measurement purposes.
- *
- * @author   Brian Doherty
- * @since    1.4.2
- * @see      #getPerf
- * @see      sun.misc.Perf$GetPerfAction
- * @see      java.nio.ByteBuffer
- */
-public final class Perf {
-
-    private static Perf instance;
-
-    private static final int PERF_MODE_RO = 0;
-    private static final int PERF_MODE_RW = 1;
-
-    private Perf() { }    // prevent instantiation
-
-    /**
-     * The GetPerfAction class is a convenience class for acquiring access
-     * to the singleton Perf instance using the
-     * <code>AccessController.doPrivileged()</code> method.
-     * <p>
-     * An instance of this class can be used as the argument to
-     * <code>AccessController.doPrivileged(PrivilegedAction)</code>.
-     * <p> Here is a suggested idiom for use of this class:
-     *
-     * <blockquote><pre>{@code
-     * class MyTrustedClass {
-     *   private static final Perf perf =
-     *       AccessController.doPrivileged(new Perf.GetPerfAction<Perf>());
-     *   ...
-     * }
-     * }</pre></blockquote>
-     * <p>
-     * In the presence of a security manager, the <code>MyTrustedClass</code>
-     * class in the above example will need to be granted the
-     * <em>"sun.misc.Perf.getPerf"</em> <code>RuntimePermission</code>
-     * permission in order to successfully acquire the singleton Perf instance.
-     * <p>
-     * Please note that the <em>"sun.misc.Perf.getPerf"</em> permission
-     * is not a JDK specified permission.
-     *
-     * @see  java.security.AccessController#doPrivileged(PrivilegedAction)
-     * @see  java.lang.RuntimePermission
-     */
-    public static class GetPerfAction implements PrivilegedAction<Perf>
-    {
-        /**
-         * Run the <code>Perf.getPerf()</code> method in a privileged context.
-         *
-         * @see #getPerf
-         */
-        public Perf run() {
-            return getPerf();
-        }
-    }
-
-    /**
-     * Return a reference to the singleton Perf instance.
-     * <p>
-     * The getPerf() method returns the singleton instance of the Perf
-     * class. The returned object provides the caller with the capability
-     * for accessing the instrumentation buffer for this or another local
-     * Java virtual machine.
-     * <p>
-     * If a security manager is installed, its <code>checkPermission</code>
-     * method is called with a <code>RuntimePermission</code> with a target
-     * of <em>"sun.misc.Perf.getPerf"</em>. A security exception will result
-     * if the caller has not been granted this permission.
-     * <p>
-     * Access to the returned <code>Perf</code> object should be protected
-     * by its caller and not passed on to untrusted code. This object can
-     * be used to attach to the instrumentation buffer provided by this Java
-     * virtual machine or for those of other Java virtual machines running
-     * on the same s